summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-01-28 13:10:32 +0000
committerEric Andersen <andersen@codepoet.org>2002-01-28 13:10:32 +0000
commit75d013b16a0764bf393628d241f05729a81d9b8d (patch)
tree8bdf9f4e01c06afc2536a30ebe48e034a7da85e7
parent03f7612acc323011a680c64d613badc62017d3fa (diff)
Fix the bug where binaries built with older toolchains would
segfault. Turns out that 'ld -nostdlib' was the culprit. Who wouldof thought... -Erik
-rw-r--r--Rules.mak4
-rw-r--r--ldso/libdl/Makefile6
-rw-r--r--ldso/util/Makefile22
-rw-r--r--libc/Makefile5
-rw-r--r--libcrypt/Makefile6
-rw-r--r--libm/Makefile6
-rw-r--r--libpthread/Makefile6
-rw-r--r--libresolv/Makefile6
-rw-r--r--libutil/Makefile6
9 files changed, 36 insertions, 31 deletions
diff --git a/Rules.mak b/Rules.mak
index 68beb93b5..df86af700 100644
--- a/Rules.mak
+++ b/Rules.mak
@@ -88,11 +88,11 @@ NATIVE_CFLAGS=-O2 -Wall
ifeq ($(strip $(DODEBUG)),true)
CFLAGS += -g
- LDFLAGS = -shared -nostdlib --warn-common --warn-once -z combreloc
+ LDFLAGS = -shared --warn-common --warn-once -z combreloc
STRIPTOOL = /bin/true -Since_we_are_debugging
else
CFLAGS += -DNDEBUG #-fomit-frame-pointer
- LDFLAGS = -s -shared -nostdlib --warn-common --warn-once -z combreloc
+ LDFLAGS = -s -shared --warn-common --warn-once -z combreloc
endif
ifeq ($(strip $(HAVE_SHARED)),true)
diff --git a/ldso/libdl/Makefile b/ldso/libdl/Makefile
index 50339ebdf..b58747e88 100644
--- a/ldso/libdl/Makefile
+++ b/ldso/libdl/Makefile
@@ -50,9 +50,9 @@ $(OBJS): %.o : %.c
$(OBJ): Makefile
shared: all
- $(LD) $(LDFLAGS) -o $(LIBDL_SHARED_FULLNAME) \
- -soname=$(LIBDL_SHARED).$(MAJOR_VERSION) \
- --whole-archive $(LIBDL) -Bdynamic -L$(TOPDIR)/lib -lc;
+ $(LD) $(LDFLAGS) -soname=$(LIBDL_SHARED).$(MAJOR_VERSION) \
+ -o $(LIBDL_SHARED_FULLNAME) --whole-archive $(LIBDL) \
+ --no-whole-archive -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/ldso/util/Makefile b/ldso/util/Makefile
index d514f3f9a..ee0c8031c 100644
--- a/ldso/util/Makefile
+++ b/ldso/util/Makefile
@@ -22,8 +22,9 @@
TOPDIR=../../
include $(TOPDIR)Rules.mak
+TARGET_CC = $(TOPDIR)extra/gcc-uClibc/$(NATIVE_ARCH)-uclibc-gcc
-TARGETS=ldd.uclibc ldd readelf ldconfig
+TARGETS=ldconfig ldd ldd.target readelf readelf.target
all: $(TARGETS)
readsoname.o: readsoname.c readsoname2.c
@@ -36,7 +37,11 @@ ldconfig.o: ldconfig.c
$(STRIPTOOL) -x -R .note -R .comment $*.o
readelf: readelf.c
- $(CC) $(CFLAGS) -static readelf.c -o $@
+ $(NATIVE_CC) $(NATIVE_CFLAGS) readelf.c -o $@
+ $(STRIPTOOL) -x -R .note -R .comment $@
+
+readelf.target: readelf.c
+ $(TARGET_CC) $(CFLAGS) -static -s readelf.c -o $@
$(STRIPTOOL) -x -R .note -R .comment $@
ifeq ($(strip $(LIBRARY_CACHE)),)
@@ -44,24 +49,25 @@ ldconfig:
echo "LIBRARY_CACHE disabled -- not building ldconfig"
else
ldconfig: ldconfig.o readsoname.o
- $(CC) $(CFLAGS) -static $^ -o $@
+ $(CC) $(CFLAGS) $^ -o $@
$(STRIPTOOL) -x -R .note -R .comment $@
endif
ldd: ldd.c
- $(CC) $(CFLAGS) -DUCLIBC_TARGET_PREFIX=\"$(TARGET_PREFIX)\" \
+ $(NATIVE_CC) $(NATIVE_CFLAGS) -DUCLIBC_TARGET_PREFIX=\"$(TARGET_PREFIX)\" \
-DUCLIBC_DEVEL_PREFIX=\"$(DEVEL_PREFIX)\" \
-DUCLIBC_BUILD_DIR=\"$(shell cd $(TOPDIR) && pwd)\" \
-DUCLIBC_LDSO=\"$(UCLIBC_LDSO)\" \
- -static ldd.c -o $@
+ ldd.c -o $@
$(STRIPTOOL) -x -R .note -R .comment $@
-ldd.uclibc: ldd.c
- $(NATIVE_CC) $(NATIVE_CFLAGS) -s -DUCLIBC_TARGET_PREFIX=\"$(TARGET_PREFIX)\" \
+ldd.target: ldd.c
+ $(TARGET_CC) $(CFLAGS) -static -s -DUCLIBC_TARGET_PREFIX=\"$(TARGET_PREFIX)\" \
-DUCLIBC_DEVEL_PREFIX=\"$(DEVEL_PREFIX)\" \
-DUCLIBC_BUILD_DIR=\"$(shell cd $(TOPDIR) && pwd)\" \
-DUCLIBC_LDSO=\"$(UCLIBC_LDSO)\" \
- ldd.c -o $@
+ ldd.c -o $@
+ $(STRIPTOOL) -x -R .note -R .comment $@
clean:
rm -f $(TARGETS) *.o *~ core
diff --git a/libc/Makefile b/libc/Makefile
index 778e21f7d..0d5d758eb 100644
--- a/libc/Makefile
+++ b/libc/Makefile
@@ -46,9 +46,8 @@ shared: $(TOPDIR)lib/$(LIBNAME)
$(AR) rv ./tmp/libgcc-need.a
@(cd tmp && CC=$(CC) LD=$(LD) NM=$(NM) AR=$(AR) \
/bin/sh ../../extra/scripts/get-needed-libgcc-objects.sh)
- $(LD) $(LDFLAGS) -o $(SHARED_FULLNAME) -soname=$(SHARED_MAJORNAME) \
- --dynamic-linker $(DYNAMIC_LINKER) --whole-archive $(LIBNAME) \
- ./tmp/libgcc-need.a -Bdynamic $(LDSO)
+ $(LD) $(LDFLAGS) -soname=$(SHARED_MAJORNAME) -o $(SHARED_FULLNAME) \
+ --whole-archive ./tmp/libgcc-need.a $(LIBNAME) --no-whole-archive $(LDSO)
@/bin/true #rm -rf tmp
install -d $(TOPDIR)lib
rm -f $(TOPDIR)lib/$(SHARED_FULLNAME)
diff --git a/libcrypt/Makefile b/libcrypt/Makefile
index 7a449745e..73bebd9db 100644
--- a/libcrypt/Makefile
+++ b/libcrypt/Makefile
@@ -48,9 +48,9 @@ $(OBJS): %.o : %.c
$(OBJ): Makefile
shared: all
- $(LD) $(LDFLAGS) -o $(LIBCRYPT_SHARED_FULLNAME) \
- -soname=$(LIBCRYPT_SHARED).$(MAJOR_VERSION) \
- --whole-archive $(LIBCRYPT) -Bdynamic -L$(TOPDIR)/lib -lc;
+ $(LD) $(LDFLAGS) -soname=$(LIBCRYPT_SHARED).$(MAJOR_VERSION) \
+ -o $(LIBCRYPT_SHARED_FULLNAME) --whole-archive $(LIBCRYPT) \
+ --no-whole-archive -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 c1b0270e0..3cd82d686 100644
--- a/libm/Makefile
+++ b/libm/Makefile
@@ -93,9 +93,9 @@ $(LIBM): ar-target
shared: all
@if [ -f $(LIBM) ] ; then \
set -x -e; \
- $(LD) $(LDFLAGS) -o $(LIBM_SHARED_FULLNAME) \
- -soname=$(LIBM_SHARED).$(MAJOR_VERSION) \
- --whole-archive $(LIBM) -Bdynamic -L$(TOPDIR)/lib -lc; \
+ $(LD) $(LDFLAGS) -soname=$(LIBM_SHARED).$(MAJOR_VERSION) \
+ -o $(LIBM_SHARED_FULLNAME) --whole-archive $(LIBM) \
+ --no-whole-archive -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/libpthread/Makefile b/libpthread/Makefile
index 2fde589e5..66414ecbc 100644
--- a/libpthread/Makefile
+++ b/libpthread/Makefile
@@ -48,9 +48,9 @@ $(OBJS): %.o : %.c
$(OBJ): Makefile
shared: all
- $(LD) $(LDFLAGS) -o $(LIBPTHREAD_SHARED_FULLNAME) \
- -soname=$(LIBPTHREAD_SHARED).$(MAJOR_VERSION) \
- --whole-archive $(LIBPTHREAD) -Bdynamic -L$(TOPDIR)/lib -lc;
+ $(LD) $(LDFLAGS) -soname=$(LIBPTHREAD_SHARED).$(MAJOR_VERSION) \
+ -o $(LIBPTHREAD_SHARED_FULLNAME) --whole-archive $(LIBPTHREAD) \
+ --no-whole-archive -L$(TOPDIR)/lib -lc;
install -d $(TOPDIR)lib
rm -f $(TOPDIR)lib/$(LIBPTHREAD_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBPTHREAD_SHARED).$(MAJOR_VERSION)
install -m 644 $(LIBPTHREAD_SHARED_FULLNAME) $(TOPDIR)lib;
diff --git a/libresolv/Makefile b/libresolv/Makefile
index a19ab0f39..1da125a62 100644
--- a/libresolv/Makefile
+++ b/libresolv/Makefile
@@ -49,9 +49,9 @@ $(OBJS): %.o : %.c
$(OBJ): Makefile
shared: all
- $(LD) $(LDFLAGS) -o $(LIBRESOLV_SHARED_FULLNAME) \
- -soname=$(LIBRESOLV_SHARED).$(MAJOR_VERSION) \
- --whole-archive $(LIBRESOLV) -Bdynamic -L$(TOPDIR)/lib -lc;
+ $(LD) $(LDFLAGS) -soname=$(LIBRESOLV_SHARED).$(MAJOR_VERSION) \
+ -o $(LIBRESOLV_SHARED_FULLNAME) --whole-archive $(LIBRESOLV) \
+ --no-whole-archive -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 a6351a26f..7ed8239e2 100644
--- a/libutil/Makefile
+++ b/libutil/Makefile
@@ -50,9 +50,9 @@ $(OBJS): %.o : %.c
$(STRIPTOOL) -x -R .note -R .comment $*.o
shared: all
- $(LD) $(LDFLAGS) -o $(LIBUTIL_SHARED_FULLNAME) \
- -soname=$(LIBUTIL_SHARED).$(MAJOR_VERSION) \
- --whole-archive $(LIBUTIL) -Bdynamic -L$(TOPDIR)/lib -lc;
+ $(LD) $(LDFLAGS) -soname=$(LIBUTIL_SHARED).$(MAJOR_VERSION) \
+ -o $(LIBUTIL_SHARED_FULLNAME) --whole-archive $(LIBUTIL) \
+ --no-whole-archive -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/;