diff mbox

Remove CFLAGS for interp.c

Message ID 1410769267-24689-1-git-send-email-siddhesh@redhat.com
State New
Headers show

Commit Message

Siddhesh Poyarekar Sept. 15, 2014, 8:21 a.m. UTC
Replace it with including an auto-generated linker-runtime.h.
Build-tested on x86_64 and found that there was no change in the
generated code.

	* elf/Makefile (CFLAGS-interp.c): Remove.
	($(elf-objpfx)runtime-linker.h): Generate header with linker
	path string.
	* elf/interp.c: Include generated runtime-linker.h
---
 elf/Makefile | 13 ++++++++++---
 elf/interp.c |  2 ++
 2 files changed, 12 insertions(+), 3 deletions(-)

Comments

Roland McGrath Sept. 16, 2014, 3:51 p.m. UTC | #1
> +	echo "#define RUNTIME_LINKER \"$(rtlddir)/$(rtld-installed-name)\"" \

Since there is nothing at sh level that should be expanded inside the
string, I'd use single quotes (and thus no need for \ on the inner ").

Otherwise good.
diff mbox

Patch

diff --git a/elf/Makefile b/elf/Makefile
index e3bd692..bf4fda1 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -353,9 +353,16 @@  $(objpfx)ld.so: $(objpfx)librtld.os $(ld-map)
 	  | $(AWK) '($$7 ~ /^UND(|EF)$$/ && $$1 != "0:" && $$4 != "REGISTER") { print; p=1 } END { exit p != 0 }'
 	mv -f $@.new $@
 
-# interp.c exists just to get this string into the libraries.
-CFLAGS-interp.c = -D'RUNTIME_LINKER="$(rtlddir)/$(rtld-installed-name)"'
-$(objpfx)interp.os: $(common-objpfx)config.make
+# interp.c exists just to get the runtime linker path into libc.so.
+$(objpfx)interp.os: $(elf-objpfx)runtime-linker.h
+
+$(elf-objpfx)runtime-linker.h: $(elf-objpfx)runtime-linker.st; @:
+$(elf-objpfx)runtime-linker.st: $(common-objpfx)config.make
+	$(name-target-directory)
+	echo "#define RUNTIME_LINKER \"$(rtlddir)/$(rtld-installed-name)\"" \
+		> ${@:st=T}
+	$(move-if-change) ${@:st=T} ${@:st=h}
+	touch $@
 
 ifneq (ld.so,$(rtld-installed-name))
 # Make sure ld.so.1 exists in the build directory so we can link
diff --git a/elf/interp.c b/elf/interp.c
index 49c92f5..a2492bf 100644
--- a/elf/interp.c
+++ b/elf/interp.c
@@ -16,5 +16,7 @@ 
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#include <elf/runtime-linker.h>
+
 const char __invoke_dynamic_linker__[] __attribute__ ((section (".interp")))
   = RUNTIME_LINKER;