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] |
On Fri, Mar 17, 2006 at 01:34:40PM +1030, Alan Modra wrote: > * elflink.c (elf_link_add_object_symbols): Save and restore > warning sym's linked sym. I tried binutils with this patch applied to build 5300+ packages. No assertion fails, no internal errors, no segfaults anymore. Nice. There is a change in behaviour, though. Here is a small testcase: $ cat libfoo1.c int foo1(void) { return 0; } $ cat libfoo2.c extern int foo1(void); int foo2(void) { return foo1(); } $ cat foo3.c extern int foo2(void); int main(void) { return foo2(); } $ gcc -Wl,--as-needed -Wall -fpic -shared libfoo1.c -o libfoo1.so $ gcc -Wl,--as-needed -Wall -fpic -shared libfoo2.c -o libfoo2.so -L. -lfoo1 $ gcc -Wl,--as-needed -Wall foo3.c -o foo3 -L. -lfoo2 /usr/bin/ld: warning: libfoo1.so, needed by ./libfoo2.so, not found (try using -rpath or -rpath-link) ./libfoo2.so: undefined reference to `foo1' collect2: ld returned 1 exit status $ gcc -Wl,--as-needed -Wall foo3.c -o foo3 -L. -lfoo2 -Wl,-rpath-link,. All above is clear and expected. Following command changed behaviour: $ gcc -Wl,--as-needed -Wall foo3.c -o foo3 -L. -lfoo2 -lfoo1 Without --as-needed fixes it produced a warning /usr/bin/ld: warning: libfoo1.so, needed by ./libfoo2.so, not found (try using -rpath or -rpath-link) but linked executable. With --as-needed fixes it fails: /usr/bin/ld: warning: libfoo1.so, needed by ./libfoo2.so, not found (try using -rpath or -rpath-link) ./libfoo2.so: undefined reference to `foo1' collect2: ld returned 1 exit status -- ldv
Attachment:
pgp00000.pgp
Description: PGP signature
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |