This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
ld: link order changes behavior
- From: hauke strasdat <strasdat at gmail dot com>
- To: binutils at sourceware dot org
- Date: Wed, 7 Dec 2011 00:27:59 +0000
- Subject: ld: link order changes behavior
Hi,
I hope this is the right place to ask this question. If not, I apologize!
I do have two object files (foo.cpp.o, main.cpp.o).
The first link order produces one result (=correct result):
/usr/bin/g++-4.4 -g foo.cpp.o main.cpp.o -o test
./test
output: 1
The other link order produces a different result (=incorrect result):
/usr/bin/g++-4.4 -g main.cpp.o foo.cpp.o -o test
./test
output: -1
Could this be a linker bug? If yes, I would go ahead and file a bug report.
Or is a different cause likely?
Thanks,
Hauke
ld -v
GNU ld (GNU Binutils for Ubuntu) 2.21.53.20110810