This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH v2 1/2] Prepare for restoration of .interp section in libpthread.so
- From: "Dmitry V. Levin" <ldv at altlinux dot org>
- To: Roland McGrath <roland at hack dot frob dot com>
- Cc: Gleb Fotengauer-Malinovskiy <glebfm at altlinux dot org>, libc-alpha at sourceware dot org
- Date: Sun, 7 Jun 2015 02:39:59 +0300
- Subject: [PATCH v2 1/2] Prepare for restoration of .interp section in libpthread.so
- Authentication-results: sourceware.org; auth=none
- References: <20150602180401 dot GA28489 at glebfm dot cloud dot tilaa dot com> <20150602200948 dot BB5A32C3AB9 at topped-with-meat dot com> <20150602224728 dot GA19067 at altlinux dot org> <20150605210557 dot 1E1D52C39FA at topped-with-meat dot com>
Make runtime-linker.h available outside $(elf-objpfx) by moving the file
to $(common-objpfx) and the rules for it to Makerules.
* Makeconfig (+interp): Remove unused variable.
* elf/Makefile ($(objpfx)interp.os): Define for [$(build-shared) = yes]
only. Depend on $(common-objpfx)runtime-linker.h instead of
$(elf-objpfx)runtime-linker.h.
($(elf-objpfx)runtime-linker.h): Rename to
$(common-objpfx)runtime-linker.h and move ...
* Makerules [$(build-shared) = yes]: ... here.
* elf/interp.c: Include <runtime-linker.h> instead of
<elf/runtime-linker.h>.
---
ChangeLog | 12 ++++++++++++
Makeconfig | 1 -
Makerules | 10 ++++++++++
elf/Makefile | 12 +++---------
elf/interp.c | 2 +-
5 files changed, 26 insertions(+), 11 deletions(-)
diff --git a/Makeconfig b/Makeconfig
index d32a0fd..0f4b549 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -596,7 +596,6 @@ endif
# Variants of the two previous definitions for statically linking programs.
+prectorT = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbeginT.o`
+postctorT = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtend.o`
-+interp = $(addprefix $(elf-objpfx),interp.os)
csu-objpfx = $(common-objpfx)csu/
elf-objpfx = $(common-objpfx)elf/
diff --git a/Makerules b/Makerules
index c79915f..ad9d74f 100644
--- a/Makerules
+++ b/Makerules
@@ -123,6 +123,16 @@ $(common-objpfx)libc-abis.stamp: $(..)scripts/gen-libc-abis \
common-generated += $(common-objpfx)libc-abis.h
endif # avoid-generated
+ifeq (yes,$(build-shared))
+$(common-objpfx)runtime-linker.h: $(common-objpfx)runtime-linker.stamp; @:
+$(common-objpfx)runtime-linker.stamp: $(common-objpfx)config.make
+ $(make-target-directory)
+ echo '#define RUNTIME_LINKER "$(rtlddir)/$(rtld-installed-name)"' \
+ > ${@:stamp=T}
+ $(move-if-change) ${@:stamp=T} ${@:stamp=h}
+ touch $@
+endif
+
# Make sure the subdirectory for object files gets created.
ifdef objpfx
ifeq (,$(wildcard $(objpfx).))
diff --git a/elf/Makefile b/elf/Makefile
index f2a115a..871cb4f 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -365,16 +365,10 @@ $(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 $@
+ifeq (yes,$(build-shared))
# 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
- $(make-target-directory)
- echo '#define RUNTIME_LINKER "$(rtlddir)/$(rtld-installed-name)"' \
- > ${@:st=T}
- $(move-if-change) ${@:st=T} ${@:st=h}
- touch $@
+$(objpfx)interp.os: $(common-objpfx)runtime-linker.h
+endif
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 5d4246a..422ea95e 100644
--- a/elf/interp.c
+++ b/elf/interp.c
@@ -16,7 +16,7 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <elf/runtime-linker.h>
+#include <runtime-linker.h>
const char __invoke_dynamic_linker__[] __attribute__ ((section (".interp")))
= RUNTIME_LINKER;
--
ldv