This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.
Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hi! glibc built on ppc64 using gcc -m64 where gcc defaults to -m32 if no -m64 is given results in all libpthread tests failed. Instead of hacking yet another ugly hack ala sparc or x86_64, the following patch hardlinks the crtfiles to where gcc will be actually looking for them. The search order of gcc when searching for these files is to go through gcc -print-search-dirs | sed -n 's/^libraries: =//p' in the first round appending the GCC resp. OS multidir names (depending on whether a particular directory is under toolchain or OS control) and if a file is not found there, it does another round without the multidirs appended. Say on the above mentioned ppc configuration, GCC multidir is 64 and OS multidir is ../lib64, one of the first directories it tries is $(objpfx)64, later on /usr/lib/../lib64 where it actually finds the crt file and stops, but if it would not find it there, a little bit later it would search $(objpfx) and if the file wouldn't be there it would continue to /usr/lib/. With this patch, the crt files are found immediately in a subdir of $(objpfx). NPTL would need similar change (although it only uses crti.o and not crtn.o). 2003-04-10 Jakub Jelinek <jakub at redhat dot com> * Makefile (multidir, crti-objs, crtn-objs): New variables. (generated-dirs): Add pathname component of multidir. (omit-deps, extra-objs): Include $(multidir)/crt? as well. ($(objpfx)libpthread.so): Depend on $(multidir)/crt?.o as well. ($(objpfx)$(multidir), $(objpfx)$(multidir)/crti.o, $(objpfx)$(multidir)/crtn.o): New. * sysdeps/unix/sysv/linux/sparc/Makefile: Removed. * sysdeps/unix/sysv/linux/x86_64/Makefile (LDFLAGS-pthread.so, before-compile, generated): Don't generate and use specs. ($(objpfx)specs): Remove. --- linuxthreads/sysdeps/unix/sysv/linux/sparc/Makefile.jj 2003-03-20 05:58:49.000000000 -0500 +++ linuxthreads/sysdeps/unix/sysv/linux/sparc/Makefile 2003-04-10 18:08:01.000000000 -0400 @@ -1,11 +0,0 @@ -ifeq ($(subdir),linuxthreads) -# gcc has /usr/lib{,64}/crti.o hardcoded in the specs file, because otherwise -# it would normally find {64,32}bit crt[in].o. -LDFLAGS-pthread.so += -specs=$(objpfx)specs -before-compile += $(objpfx)specs -generated += specs -$(objpfx)specs: - $(CC) $(CFLAGS) $(CPPFLAGS) -dumpspecs \ - | sed 's~\(/usr/lib\(\|64\)/\|^\|\([^/a-z]\)\)\(crt[in]\.o\)~\3'$(objpfx)'\4~g' > $ at dot new - mv -f $ at dot new $@ -endif --- linuxthreads/sysdeps/unix/sysv/linux/x86_64/Makefile.jj 2003-02-22 17:53:59.000000000 -0500 +++ linuxthreads/sysdeps/unix/sysv/linux/x86_64/Makefile 2003-04-10 18:08:33.000000000 -0400 @@ -1,12 +1,3 @@ ifeq ($(subdir),linuxthreads) CFLAGS-pt-initfini.s = -g0 -fPIC -fno-inline-functions -fno-asynchronous-unwind-tables -# gcc -m64 has /usr/lib64/crti.o hardcoded in the specs file, because otherwise -# it would normally find 32bit crti.o. -LDFLAGS-pthread.so += -specs=$(objpfx)specs -before-compile += $(objpfx)specs -generated += specs -$(objpfx)specs: - $(CC) $(CFLAGS) $(CPPFLAGS) -dumpspecs \ - | sed 's,\(/usr/lib\(\|64\)/\|^\|\([^/a-z]\)\)\(crt[in]\.o\),\3./\4,g' > $ at dot new - mv -f $ at dot new $@ endif --- linuxthreads/Makefile.jj 2003-04-03 05:27:37.000000000 -0500 +++ linuxthreads/Makefile 2003-04-10 18:10:34.000000000 -0400 @@ -79,7 +79,16 @@ $(objpfx)libpthread_nonshared.a: $(addpr ifeq ($(build-shared),yes) -extra-objs += crti.o crtn.o +multidir := $(shell $(CC) $(CFLAGS) $(CPPFLAGS) -print-multi-directory) +crti-objs := crti.o +crtn-objs := crtn.o +ifneq ($(multidir),.) +generated-dirs := $(firstword $(subst /, , $(multidir))) +crti-objs += $(multidir)/crti.o +crtn-objs += $(multidir)/crtn.o +omit-deps += $(multidir)/crti $(multidir)/crtn +endif +extra-objs += $(crti-objs) $(crtn-objs) omit-deps += crti crtn CFLAGS-pt-initfini.s = -g0 -fPIC -fno-inline-functions @@ -132,9 +141,9 @@ $(inst_libdir)/libpthread_nonshared.a: $ extra-B-pthread.so = -B$(common-objpfx)linuxthreads/ -$(objpfx)libpthread.so: $(objpfx)crti.o $(objpfx)crtn.o -$(objpfx)libpthread.so: +preinit += $(objpfx)crti.o -$(objpfx)libpthread.so: +postinit += $(objpfx)crtn.o +$(objpfx)libpthread.so: $(addprefix $(objpfx),$(crti-objs) $(crtn-objs)) +$(objpfx)libpthread.so: +preinit += $(addprefix $(objpfx),$(crti-objs)) +$(objpfx)libpthread.so: +postinit += $(addprefix $(objpfx),$(crtn-objs)) znodelete-yes = -DHAVE_Z_NODELETE CFLAGS-mutex.c += -D__NO_WEAK_PTHREAD_ALIASES @@ -249,6 +258,17 @@ $(objpfx)crti.o: $(objpfx)crti.S $(objpf $(objpfx)crtn.o: $(objpfx)crtn.S $(objpfx)defs.h $(compile.S) -g0 $(ASFLAGS-.os) -o $@ +ifneq ($(multidir),.) +$(objpfx)$(multidir): + @mkdir -p $(objpfx)$(multidir) + +$(objpfx)$(multidir)/crti.o: $(objpfx)crti.o $(objpfx)$(multidir) + ln -f $< $@ + +$(objpfx)$(multidir)/crtn.o: $(objpfx)crtn.o $(objpfx)$(multidir) + ln -f $< $@ +endif + generated += crti.S crtn.S defs.h pt-initfini.s endif Jakub
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |