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]

[PATCH] Avoid using two -B options for building libpthread.so


Hi!

This patch fixes glibc build on ia64 when the compiler is gnupro-1117, but I
guess building glibc with 2.95.2 would fail to work on i686/--enable-kernel
2.4.0 and other arches as well.
As I wrote to Ulrich already, various gcc drivers search the -B paths in
various orders (first-to-last, last-to-first or even do program searches one
way and object file searches the other way) and thus unfortunately glibc
cannot count on first-to-last search.
Tested on ia64-linux both with gnupro-1117 and gcc-2.96-RH plus on
i686-linux (gcc-2.96-RH).

2001-02-08  Jakub Jelinek  <jakub@redhat.com>

	* Makerules (build-shlib): Replace extra-B- with special-B-,
	only pass one -B prefix to gcc.

	* Makefile (before-compile): Add crtn.o.
	(extra-B-pthread.so): Rename to...
	(special-B-pthread.so): ...this.
	(crti.S): New rule.
	(crt%.o): Change from crti.o rule.

--- libc/Makerules.jj	Tue Feb  6 11:19:52 2001
+++ libc/Makerules	Thu Feb  8 13:55:01 2001
@@ -415,7 +415,8 @@ lib%.so: lib%_pic.a $(+preinit) $(+posti
 
 define build-shlib
 $(LINK.o) -shared -Wl,-O1 -o $@ $(sysdep-LDFLAGS) $(config-LDFLAGS)  \
-	  $(extra-B-$(@F:lib%.so=%).so) -B$(csu-objpfx) $(load-map-file) \
+	  $(patsubst ,-B$(csu-objpfx),$(special-B-$(@F:lib%.so=%).so)) \
+	  $(load-map-file) \
 	  -Wl,-soname=lib$(libprefix)$(@F:lib%.so=%).so$($(@F)-version) \
 	  $(LDFLAGS.so) $(LDFLAGS-$(@F:lib%.so=%).so) \
 	  -L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link) \
--- libc/linuxthreads/Makefile.jj	Sat Feb  3 12:03:21 2001
+++ libc/linuxthreads/Makefile	Thu Feb  8 13:58:01 2001
@@ -47,7 +47,7 @@ vpath %.c Examples
 include ../Makeconfig
 
 ifeq ($(build-shared),yes)
-before-compile := $(objpfx)crti.o
+before-compile := $(objpfx)crti.o $(objpfx)crtn.o
 
 CFLAGS-pt-initfini.s = -g0 -fPIC -fno-inline-functions
 endif
@@ -62,7 +62,7 @@ endif
 
 include ../Rules
 
-extra-B-pthread.so = -B$(common-objpfx)linuxthreads/
+special-B-pthread.so = -B$(common-objpfx)linuxthreads/
 
 znodelete-yes = -DHAVE_Z_NODELETE
 CFLAGS-mutex.c += -D__NO_WEAK_PTHREAD_ALIASES
@@ -105,12 +105,17 @@ $(objpfx)crti.S: $(objpfx)pt-initfini.s
 	       -e '/@_.*_PROLOG_BEGINS/,/@_.*_PROLOG_ENDS/p' \
 	       -e '/@TRAILER_BEGINS/,$$p' $< > $@
 
+$(objpfx)crtn.S: $(objpfx)pt-initfini.s
+	sed -n -e '1,/@HEADER_ENDS/p' \
+	       -e '/@_.*_EPILOG_BEGINS/,/@_.*_EPILOG_ENDS/p' \
+	       -e '/@TRAILER_BEGINS/,$$p' $< > $@
+
 $(objpfx)defs.h: $(objpfx)pt-initfini.s
 	sed -n -e '/@TESTS_BEGIN/,/@TESTS_END/p' $< | \
 		$(AWK) -f ../csu/defs.awk > $@
 
-$(objpfx)crti.o: $(objpfx)crti.S $(objpfx)defs.h
+$(objpfx)crt%.o: $(objpfx)crt%.S $(objpfx)defs.h
 	$(compile.S) -g0 $(ASFLAGS-.os) -o $@
 
-generated += crti.S defs.h pt-initfini.s
+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]