From b58a631942341b6ccb62ab400e862f404e22dbbf Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Tue, 1 Oct 2002 05:30:25 +0000 Subject: This commit contains a patch from Stefan Allius to change how uClibc handles _init and _fini, allowing shared lib constructors and destructors to initialize things in the correct sequence. Stefan ported the SH architecture. I then ported x86, arm, and mips. x86 and arm are working fine, but I don't think I quite got things correct for mips. --- libpthread/Makefile | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'libpthread/Makefile') diff --git a/libpthread/Makefile b/libpthread/Makefile index 7566b4753..7edf34f66 100644 --- a/libpthread/Makefile +++ b/libpthread/Makefile @@ -36,6 +36,15 @@ ifeq ($(strip $(DODEBUG)),true) endif endif +GCC_LIB_DIR = $(dir $(shell $(CC) -print-libgcc-file-name )) +ifeq ($(strip $(DOPIC)),true) + START_FILES = $(TOPDIR)lib/crti.o $(GCC_LIB_DIR)crtbeginS.o + END_FILES = $(GCC_LIB_DIR)crtendS.o $(TOPDIR)lib/crtn.o +else + START_FILES = $(TOPDIR)lib/crti.o $(GCC_LIB_DIR)crtbegin.o + END_FILES = $(GCC_LIB_DIR)crtend.o $(TOPDIR)lib/crtn.o +endif + ALL_SUBDIRS = linuxthreads linuxthreads_db all: $(LIBPTHREAD) $(LIBTHREAD_DB) @@ -67,9 +76,9 @@ shared: all if [ -f $(LIBPTHREAD) ] ; then \ set -e; \ $(LD) $(LDFLAGS) -soname=$(LIBPTHREAD_SHARED).$(MAJOR_VERSION) \ - -o $(LIBPTHREAD_SHARED_FULLNAME) --whole-archive $(LIBPTHREAD) \ + -o $(LIBPTHREAD_SHARED_FULLNAME) $(START_FILES) --whole-archive $(LIBPTHREAD) \ --no-whole-archive $(TOPDIR)/libc/misc/internals/interp.o \ - -L$(TOPDIR)/lib -lc; \ + -L$(TOPDIR)/lib -lc $(END_FILES); \ install -d $(TOPDIR)lib; \ rm -f $(TOPDIR)lib/$(LIBPTHREAD_SHARED_FULLNAME) \ $(TOPDIR)lib/$(LIBPTHREAD_SHARED).$(MAJOR_VERSION); \ @@ -82,9 +91,9 @@ shared: all if [ -f $(LIBTHREAD_DB) ] ; then \ set -e; \ $(LD) $(LDFLAGS) -soname=$(LIBTHREAD_DB_SHARED).$(MAJOR_VERSION) \ - -o $(LIBTHREAD_DB_SHARED_FULLNAME) --whole-archive $(LIBTHREAD_DB) \ + -o $(LIBTHREAD_DB_SHARED_FULLNAME) $(START_FILES) --whole-archive $(LIBTHREAD_DB) \ --no-whole-archive $(TOPDIR)/libc/misc/internals/interp.o \ - -L$(TOPDIR)/lib -lc; \ + -L$(TOPDIR)/lib -lc $(END_FILES); \ install -d $(TOPDIR)lib; \ rm -f $(TOPDIR)lib/$(LIBTHREAD_DB_SHARED_FULLNAME) \ $(TOPDIR)lib/$(LIBTHREAD_DB_SHARED).$(MAJOR_VERSION); \ -- cgit v1.2.3