[Bug ld/17287] New: --as-needed unresolved symbols with dummy shared library in command line

2014-08-17 Thread amodra at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=17287

Bug ID: 17287
   Summary: --as-needed unresolved symbols with dummy shared
library in command line
   Product: binutils
   Version: 2.25 (HEAD)
Status: NEW
  Severity: normal
  Priority: P2
 Component: ld
  Assignee: unassigned at sourceware dot org
  Reporter: amodra at gmail dot com

Documented --as-needed behaviour says one condition a library is needed is
"..if the library is not found in the DT_NEEDED lists of other libraries, a
non-weak undefined symbol reference from another dynamic library."  I think the
documentation should say "..DT_NEEDED lists of other *needed* libraries".
Otherwise we have the following odd behaviour.

cat > foo.c <<\EOF
void foo() {}
EOF
cat > bar.c <<\EOF
extern void foo();
void bar() { foo (); }
EOF
echo -n > dummy.c
cat > app.c <<\EOF
extern void bar();
int main() { bar(); return 0; }
EOF
gcc -fPIC -shared -o libfoo.so foo.c
gcc -fPIC -shared -o libbar.so bar.c
gcc -fPIC -shared -o libdummy.so -Wl,--no-as-needed -L. -lfoo
gcc -fPIC -o app app.c -Wl,--as-needed -L. -lbar -lfoo
gcc -fPIC -o app app.c -Wl,--as-needed -L. -lbar -ldummy -lfoo
./libbar.so: undefined reference to `foo'
collect2: ld returned 1 exit status

-- 
You are receiving this mail because:
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/17287] DT_NEEDED of unneeded libraries affects --as-needed

2014-08-17 Thread amodra at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=17287

Alan Modra  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at sourceware dot org   |amodra at gmail dot com
Summary|--as-needed unresolved  |DT_NEEDED of unneeded
   |symbols with dummy shared   |libraries affects
   |library in command line |--as-needed

-- 
You are receiving this mail because:
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils