This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
--unresolved-symbols patch breaks autoconf tests
- From: Rainer Orth <ro at TechFak dot Uni-Bielefeld dot DE>
- To: Nick Clifton <nickc at redhat dot com>
- Cc: binutils at sources dot redhat dot com
- Date: Fri, 19 Sep 2003 21:02:30 +0200 (MEST)
- Subject: --unresolved-symbols patch breaks autoconf tests
Nick,
[Please keep me on the Cc:, I'm not subscribed to this list.]
I've just tried bootstrapping current GCC mainline on mips-sgi-irix5.3 with
GNU as and ld from binutils CVS mainline. While the bootstrap proper worked
ok, building the target libiberty failed because all configure tests for
the availability of functions erroneously returned success ;-(
I could trace this to this patch of yours:
http://sources.redhat.com/ml/binutils/2003-08/msg00319.html
The problem is demonstrated by the following example:
$ cat nosf.c
int
main (void)
{
return nosuchfunction();
}
$ gcc -c nosf.c
$ ./xgcc -B./ -v -o nosf nosf.o
Reading specs from ./specs
Configured with: '/home/ro/build/gcc/gcc/configure' '--prefix=/home/ro '--disable-nls '--with-gnu-as '--with-as=/home/ro/bin/gas-2.14.90 '--with-gnu-ld '--with-ld=/home/ro/bin/gld-2.14.90
Thread model: single
gcc version 3.4 20030909 (experimental)
./collect2 -call_shared -init __do_global_ctors -fini __do_global_dtors -melf32bsmip -o nosf /usr/lib/crt1.o ./crtbegin.o -L. -L/home/ro/lib/../mips-sgi-irix5.3/lib -L/home/ro/lib nosf.o -lgcc -lgcc_eh -lc -lgcc -lgcc_eh ./crtend.o /usr/lib/crtn.o
nosf.o(.text+0x10): In function `main':
nosf.c:1: undefined reference to `nosuchfunction'
collect2: ld returned 1 exit status
$ echo $?
0
Of course this is wrong: the link should fail in this situation, and GNU ld
2.14 behaved differently/correctly:
$ gld-2.14 -call_shared -init __do_global_ctors -fini __do_global_dtors -melf32bsmip -o nosf /usr/lib/crt1.o ./crtbegin.o -L. -L/home/ro/lib/../mips-sgi-irix5.3/lib -L/home/ro/lib nosf.o -lgcc -lgcc_eh -lc -lgcc -lgcc_eh ./crtend.o /usr/lib/crtn.o
gld-2.14: ./crtbegin.o: linking abicalls files with non-abicalls files
Bad value: failed to merge target specific data of file ./crtbegin.o
gld-2.14: ./crtend.o: linking abicalls files with non-abicalls files
Bad value: failed to merge target specific data of file ./crtend.o
nosf.o(.text+0x10): In function `main':
nosf.c:1: undefined reference to `nosuchfunction'
$ echo $?
1
I've worked around this by adding -z defs to the LINK_SPEC, but this cannot
be right: upgrading GNU ld must not cause all LINK_SPECs in GCC to become
erroneous.
Rainer
-----------------------------------------------------------------------------
Rainer Orth, Faculty of Technology, Bielefeld University