https://sourceware.org/bugzilla/show_bug.cgi?id=16417
Alan Modra <amodra at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED CC| |amodra at gmail dot com Resolution|WONTFIX |--- --- Comment #8 from Alan Modra <amodra at gmail dot com> --- bfd ld behaviour with the testcase in comment #6 is a little weird, but I think correct given the description of --as-needed. On my x86_64 Ubuntu 12.04 box, it isn't __pthread_key_create that causes libpthread to be seen as needed. libpthread.so.0 is being included in the link due to a strong reference in libstdc++.so.6 to write@GLIBC_2.2.5. libpthread.so.0 defines a weak write@@GLIBC_2.2.5 so satisfies the --as-needed requirement. The order in which the libraries are linked, -lstdc++, -lpthread, -lc, means we haven't seen the definition in libc.so.6 for "write" at the time we're checking whether libpthread.so.6 is needed.. If I modify the order to -lstdc++, -lc, -lpthread, -lc then libpthread is seen as not needed, and the resulting a.out does not crash. So I think Cary was a little hasty in closing this bug. -- 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