summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ldso/libdl/Makefile3
-rw-r--r--libc/Makefile3
-rw-r--r--libc/misc/internals/Makefile15
-rw-r--r--libcrypt/Makefile3
-rw-r--r--libm/Makefile5
-rw-r--r--libresolv/Makefile3
-rw-r--r--libutil/Makefile3
7 files changed, 25 insertions, 10 deletions
diff --git a/ldso/libdl/Makefile b/ldso/libdl/Makefile
index deb9a7f12..0e8d0a039 100644
--- a/ldso/libdl/Makefile
+++ b/ldso/libdl/Makefile
@@ -52,7 +52,8 @@ $(OBJ): Makefile
shared:
$(LD) $(LDFLAGS) -soname=$(LIBDL_SHARED).$(MAJOR_VERSION) \
-o $(LIBDL_SHARED_FULLNAME) --whole-archive $(LIBDL) \
- --no-whole-archive -L$(TOPDIR)/lib -lc;
+ --no-whole-archive $(TOPDIR)/libc/misc/internals/interp.o \
+ -L$(TOPDIR)/lib -lc;
install -d $(TOPDIR)lib
rm -f $(TOPDIR)lib/$(LIBDL_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBDL_SHARED).$(MAJOR_VERSION)
install -m 644 $(LIBDL_SHARED_FULLNAME) $(TOPDIR)lib;
diff --git a/libc/Makefile b/libc/Makefile
index 0d5d758eb..a393b6d9f 100644
--- a/libc/Makefile
+++ b/libc/Makefile
@@ -47,7 +47,8 @@ shared: $(TOPDIR)lib/$(LIBNAME)
@(cd tmp && CC=$(CC) LD=$(LD) NM=$(NM) AR=$(AR) \
/bin/sh ../../extra/scripts/get-needed-libgcc-objects.sh)
$(LD) $(LDFLAGS) -soname=$(SHARED_MAJORNAME) -o $(SHARED_FULLNAME) \
- --whole-archive ./tmp/libgcc-need.a $(LIBNAME) --no-whole-archive $(LDSO)
+ --whole-archive ./tmp/libgcc-need.a $(LIBNAME) --no-whole-archive \
+ $(TOPDIR)/libc/misc/internals/interp.o
@/bin/true #rm -rf tmp
install -d $(TOPDIR)lib
rm -f $(TOPDIR)lib/$(SHARED_FULLNAME)
diff --git a/libc/misc/internals/Makefile b/libc/misc/internals/Makefile
index 8e4d160a9..29ffdec7b 100644
--- a/libc/misc/internals/Makefile
+++ b/libc/misc/internals/Makefile
@@ -35,17 +35,26 @@ endif
COBJS=$(patsubst %.c,%.o, $(CSRC))
OBJS=$(COBJS)
-all: $(OBJS) $(LIBC)
+all: $(OBJS) interp.o $(LIBC)
-$(LIBC): ar-target
+$(LIBC): interp.c ar-target
ar-target: $(OBJS)
$(AR) $(ARFLAGS) $(LIBC) $(OBJS)
+interp.c: Makefile
+ echo "/* Force shared libraries to know about the correct library loader */" > interp.c
+ echo "const char __dl_ldso__[] __attribute__ ((section " \
+ "(\".interp\"))) =\""$(DYNAMIC_LINKER)"\";" >> interp.c
+
$(COBJS): %.o : %.c
$(CC) $(CFLAGS) -c $< -o $@
$(STRIPTOOL) -x -R .note -R .comment $*.o
+interp.o: %.o : %.c
+ $(CC) $(CFLAGS) -c $< -o $@
+ $(STRIPTOOL) -x -R .note -R .comment $*.o
+
clean:
- rm -f *.[oa] *~ core
+ rm -f *.[oa] interp.c *~ core
diff --git a/libcrypt/Makefile b/libcrypt/Makefile
index 73bebd9db..cc623fa5e 100644
--- a/libcrypt/Makefile
+++ b/libcrypt/Makefile
@@ -50,7 +50,8 @@ $(OBJ): Makefile
shared: all
$(LD) $(LDFLAGS) -soname=$(LIBCRYPT_SHARED).$(MAJOR_VERSION) \
-o $(LIBCRYPT_SHARED_FULLNAME) --whole-archive $(LIBCRYPT) \
- --no-whole-archive -L$(TOPDIR)/lib -lc;
+ --no-whole-archive $(TOPDIR)/libc/misc/internals/interp.o \
+ -L$(TOPDIR)/lib -lc;
install -d $(TOPDIR)lib
rm -f $(TOPDIR)lib/$(LIBCRYPT_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBCRYPT_SHARED).$(MAJOR_VERSION)
install -m 644 $(LIBCRYPT_SHARED_FULLNAME) $(TOPDIR)lib;
diff --git a/libm/Makefile b/libm/Makefile
index 3cd82d686..e9cdf47df 100644
--- a/libm/Makefile
+++ b/libm/Makefile
@@ -94,8 +94,9 @@ shared: all
@if [ -f $(LIBM) ] ; then \
set -x -e; \
$(LD) $(LDFLAGS) -soname=$(LIBM_SHARED).$(MAJOR_VERSION) \
- -o $(LIBM_SHARED_FULLNAME) --whole-archive $(LIBM) \
- --no-whole-archive -L$(TOPDIR)/lib -lc; \
+ -o $(LIBM_SHARED_FULLNAME) --whole-archive $(LIBM) \
+ --no-whole-archive $(TOPDIR)/libc/misc/internals/interp.o \
+ -L$(TOPDIR)/lib -lc; \
install -d $(TOPDIR)lib; \
rm -f $(TOPDIR)lib/$(LIBM_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBM_SHARED).$(MAJOR_VERSION); \
install -m 644 $(LIBM_SHARED_FULLNAME) $(TOPDIR)lib; \
diff --git a/libresolv/Makefile b/libresolv/Makefile
index 1da125a62..57c915f4e 100644
--- a/libresolv/Makefile
+++ b/libresolv/Makefile
@@ -51,7 +51,8 @@ $(OBJ): Makefile
shared: all
$(LD) $(LDFLAGS) -soname=$(LIBRESOLV_SHARED).$(MAJOR_VERSION) \
-o $(LIBRESOLV_SHARED_FULLNAME) --whole-archive $(LIBRESOLV) \
- --no-whole-archive -L$(TOPDIR)/lib -lc;
+ --no-whole-archive $(TOPDIR)/libc/misc/internals/interp.o \
+ -L$(TOPDIR)/lib -lc;
install -d $(TOPDIR)lib
rm -f $(TOPDIR)lib/$(LIBRESOLV_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBRESOLV_SHARED).$(MAJOR_VERSION)
install -m 644 $(LIBRESOLV_SHARED_FULLNAME) $(TOPDIR)lib;
diff --git a/libutil/Makefile b/libutil/Makefile
index 7ed8239e2..919772ec1 100644
--- a/libutil/Makefile
+++ b/libutil/Makefile
@@ -52,7 +52,8 @@ $(OBJS): %.o : %.c
shared: all
$(LD) $(LDFLAGS) -soname=$(LIBUTIL_SHARED).$(MAJOR_VERSION) \
-o $(LIBUTIL_SHARED_FULLNAME) --whole-archive $(LIBUTIL) \
- --no-whole-archive -L$(TOPDIR)/lib -lc;
+ --no-whole-archive $(TOPDIR)/libc/misc/internals/interp.o \
+ -L$(TOPDIR)/lib -lc;
install -d $(TOPDIR)lib
rm -f $(TOPDIR)lib/$(LIBUTIL_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBUTIL_SHARED).$(MAJOR_VERSION)
install -m 644 $(LIBUTIL_SHARED_FULLNAME) $(TOPDIR)lib/;