about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--elf/Makefile13
-rw-r--r--elf/interp.c2
3 files changed, 17 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 45b8cde92c..37907ea248 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2014-09-16  Siddhesh Poyarekar  <siddhesh@redhat.com>
 
+	* 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
+
 	* Makerules (lib%.so): Don't include $(+interp) in
 	prerequisites.
 	* elf/Makefile (CFLAGS-interp.c): Don't define NOT_IN_libc.
diff --git a/elf/Makefile b/elf/Makefile
index e3bd69223a..94074f3e34 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 49c92f59dc..a2492bffba 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;