This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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] |
1) main calls bar. bar is defined in libfoo_alias:bar.oI tried also having foo_alias() a strong alias: does it make any changes?
2) bar calls foo_alias. foo_alias is weakly defined in libfoo_alias:foo.o, but there are no strong definitions provided elsewhere, so the weak definition is used. Hence libfoo_alias:foo.o is included in the link which brings with it a strong definition of the "foo" symbol.
3) main calls other. other is defined in libfoo.a:foo.o. libfoo.a:foo.o also defines "foo", hence there is now a duplicate definition.
Ok, thanks for your detailed explanation.. what I don't understand if why if libfoo_alias:bar calls foo instead of the alias, having always to strong definitions of foo(), the link works fine. Could you explain the path in this case?
int foo_alias(); int foo();
int bar() { //return foo_alias(); return foo(); }
% gcc -static -L. main.c -lfoo_alias -lfoo ./libfoo.a(foo.o): In function `foo': foo.c:(.text+0x0): multiple definition of `foo' ./libfoo_alias.a(foo_alias.o):foo_alias.c:(.text+0x0): first defined here
Cheers Nick
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |