Summary: | [2.24 regression] missing NEEDED libc when building with g++ -Wl,--as-needed | ||
---|---|---|---|
Product: | binutils | Reporter: | Matthias Klose <doko> |
Component: | ld | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED INVALID | ||
Severity: | normal | CC: | will.newton |
Priority: | P2 | ||
Version: | 2.24 | ||
Target Milestone: | --- | ||
Host: | Target: | ||
Build: | Last reconfirmed: |
Description
Matthias Klose
2013-06-17 11:26:24 UTC
Zack Weinberg commented in the Debian report: I think the linker is doing exactly what it's supposed to in this case -- weak symbols *shouldn't* provoke NEEDED entries all by themselves. A standard use case, for instance, is to take weak references to pthread_mutex_(un)lock and then call them only if the function addresses are non-NULL at runtime -- if that by itself dragged in libpthread it would vitiate the optimization. If you do the exact same test with a shared object that explicitly calls something in libc (say, 'puts') that's a strong reference and you will get a NEEDED entry. As for the lack of version tagging on the weak reference, I can't say whether this is a problem in general, but in the case of __cxa_finalize, I'm pretty sure it isn't: a GLIBC_2.2.5 version indicates a function that has not changed since the introduction of symbol versioning in libc.so.6, and the spec governing __cxa_finalize's behavior hasn't changed since 2003ish. The Debian bug is closed based on Alan Modra's reply here: https://sourceware.org/ml/binutils/2013-07/msg00001.html So closing this bug too. |