From 75d013b16a0764bf393628d241f05729a81d9b8d Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Mon, 28 Jan 2002 13:10:32 +0000 Subject: Fix the bug where binaries built with older toolchains would segfault. Turns out that 'ld -nostdlib' was the culprit. Who wouldof thought... -Erik --- ldso/libdl/Makefile | 6 +++--- ldso/util/Makefile | 22 ++++++++++++++-------- 2 files changed, 17 insertions(+), 11 deletions(-) (limited to 'ldso') 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 -- cgit v1.2.3