This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Strange linking error
- From: Erik Leunissen <e dot leunissen at hccnet dot nl>
- To: binutils at sourceware dot org
- Date: Thu, 13 Jul 2006 00:17:05 +0200
- Subject: Strange linking error
I perceive an incompatibility with the following linker options when
linking an object file into a shared object (ELF):
--fatal-warnings
-Map somefilename (or -M)
When supplying either, the link succeeds, and the link map is written.
In the case of "--fatal-warnings" being supplied (without -Map), there
are no warnings written to stdout or stderr.
In the case of "-Map" being supplied (without --fatal-warnings), there
are also no warnings written to stdout or stderr.
When supplying both[*], the link fails, the link map is written
(identical contents as the successful case), and the following error is
emitted:
"collect2: ld returned 1 exit status"
This error message does not say why the exit status is 1, so here is
where I get lost. Does anybody have a clue what's going on?
Thanks in advance,
Erik Leunissen
[*] below you find the complete invocation of "gcc -v" from make:
gcc -v -shared -Wl,-O2,-x,--fatal-warnings,-s,-Map,./linkmap.$$ -o
/home/erik/Develop/stealth/bin/linux-x86/foo.so
/home/erik/Develop/stealth/bin/linux-x86/foo.o
-Wl,-Bstatic,-L/usr/local/lib,-ltclstub8.4 -Wl,-Bdynamic
Reading specs from /usr/lib/gcc-lib/i586-suse-linux/3.3.1/specs
Configured with: ../configure --enable-threads=posix --prefix=/usr
--with-local-prefix=/usr/local --infodir=/usr/share/info
--mandir=/usr/share/man --libdir=/usr/lib
--enable-languages=c,c++,f77,objc,java,ada --disable-checking
--enable-libgcj --with-gxx-include-dir=/usr/include/g++
--with-slibdir=/lib --with-system-zlib --enable-shared
--enable-__cxa_atexit i586-suse-linux
Thread model: posix
gcc version 3.3.1 (SuSE Linux)
/usr/lib/gcc-lib/i586-suse-linux/3.3.1/collect2 --eh-frame-hdr -m
elf_i386 -shared -o /home/erik/Develop/stealth/bin/linux-x86/foo.so
/usr/lib/gcc-lib/i586-suse-linux/3.3.1/../../../crti.o
/usr/lib/gcc-lib/i586-suse-linux/3.3.1/crtbeginS.o
-L/usr/lib/gcc-lib/i586-suse-linux/3.3.1
-L/usr/lib/gcc-lib/i586-suse-linux/3.3.1/../../../../i586-suse-linux/lib
-L/usr/lib/gcc-lib/i586-suse-linux/3.3.1/../../.. -O2 -x
--fatal-warnings -s -Map ./linkmap.8837
/home/erik/Develop/stealth/bin/linux-x86/foo.o -Bstatic -L/usr/local/lib
-ltclstub8.4 -Bdynamic -lgcc -lc -lgcc
/usr/lib/gcc-lib/i586-suse-linux/3.3.1/crtendS.o
/usr/lib/gcc-lib/i586-suse-linux/3.3.1/../../../crtn.o
collect2: ld returned 1 exit status
make: *** [/home/erik/Develop/stealth/bin/linux-x86/foo.so] Error 1
== end of message ==