This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

sln problem figured out


Okie, I tracked down the following problem:

i686-gnu-gcc -nostdlib -nostartfiles -static -o /com/src/libc-without-tls.obj/elf/sln   /com/src/libc-without-tls.obj/csu/crt0.o /com/src/libc-without-tls.obj/csu/crti.o `i686-gnu-gcc --print-file-name=crtbegin.o` /com/src/libc-without-tls.obj/elf/sln.o  -Wl,-\( /com/src/libc-without-tls.obj/libc.a /com/src/libc-without-tls.obj/mach/libmachuser.a /com/src/libc-without-tls.obj/hurd/libhurduser.a -lgcc -Wl,--as-needed -lgcc_s -Wl,--no-as-needed -Wl,-\) `i686-gnu-gcc --print-file-name=crtend.o` /com/src/libc-without-tls.obj/csu/crtn.o
/usr/local/bin/i686-gnu-ld: cannot find -lgcc_s
collect2: ld returned 1 exit status

Which I reported sometime ago, and said that it had vanished.  But it
poped up again, and annoyed me enough to track it down.

The thing is that `link-libc-static' is redefined in
sysdeps/mach/hurd/Makefile, and recent changes (2004-05-08 Jakub
Jelinek) have changed the behaviour of `libgcc_eh' to use "-lgcc_s" if
`have-as-needed' is defined to yes.

Anyway, since `gnulib' uses `$(libgcc_eh)', this will screw things up
when compiling a static program (like sln) since it will be looking
for libgcc_s.a.

For a fix I have two ideas, the first one (with patch) is to simple
use `$(static-gnulib)' in link-libc-static instead of `$(gnulib)'.

The second one (without a patch), which I am not 100% that it is
correct, is to use the following, which will just appened the
libraries that we need when compiling a static program,

link-libc-static += -Wl,-\( \
		    $(patsubst %,$(common-objpfx)%.a,\
			       mach/libmachuser hurd/libhurduser) \
		    -Wl,-\)

instead of the current:

link-libc-static := -Wl,-\( \
		    $(patsubst %,$(common-objpfx)%.a,\
			       libc mach/libmachuser hurd/libhurduser) \
		    $(gnulib) -Wl,-\)


Ditto for the case when $(build-shared) is yes.  Roland, what is your
opinion about this?


2004-10-16  Alfred M. Szmidt  <ams@kemisten.nu>

	* sysdeps/mach/hurd/Makefile (link-libc-static): Use
	`$(static-gnulib') instead of `$(gnulib)'.

--- sysdeps/mach/hurd/Makefile	27 Jun 2003 08:21:33 +0200	1.94
+++ sysdeps/mach/hurd/Makefile	16 Oct 2004 16:56:53 +0200	
@@ -1,4 +1,4 @@
-# Copyright (C) 1993,94,95,96,97,98,99,2000,2001,2002, 2003
+# Copyright (C) 1993,94,95,96,97,98,99,2000,2001,2002, 2003, 2004
 #	Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
@@ -177,14 +177,14 @@ ifeq (yes,$(build-static))
 link-libc-static := -Wl,-\( \
 		    $(patsubst %,$(common-objpfx)%.a,\
 			       libc mach/libmachuser hurd/libhurduser) \
-		    $(gnulib) -Wl,-\)
+		    $(static-gnulib) -Wl,-\)
 else
 ifeq (yes,$(build-shared))
 # We can try to link the programs with lib*_pic.a...
 link-libc-static := $(link-libc) -Wl,-\( \
 		    $(patsubst %,$(common-objpfx)%_pic.a,\
 			       libc mach/libmachuser hurd/libhurduser) \
-		    $(gnulib) -Wl,-\)
+		    $(static-gnulib) -Wl,-\)
 endif
 endif
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]