In this scenario:
f.c
===
void f() {}
main.c
======
int main () { f(); }
$ gcc -c f.c
$ ar cr libf.a f.o
$ gcc main.c -Wl,--defsym=f=4 -L. -lf
the linker pulls in f.o from libf.a, even though f has been explicitly defined
on the command line.
As described here:
http://sourceware.org/ml/binutils/2010-09/msg00110.html
the consensus is that this is a defect in GNU LD and in Gold.
--
Summary: Linker includes archive members when symbols therein
have already been defined
Product: binutils
Version: 2.21 (HEAD)
Status: NEW
Severity: normal
Priority: P2
Component: ld
AssignedTo: unassigned at sources dot redhat dot com
ReportedBy: mark at codesourcery dot com
CC: bug-binutils at gnu dot org
http://sourceware.org/bugzilla/show_bug.cgi?id=12001
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
_______________________________________________
bug-binutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-binutils