Sourceware Bugzilla – Full Text Bug Listing
|Summary:||Weak definitions aren't so weak|
|Product:||glibc||Reporter:||Samuel Thibault <samuel.thibault>|
|Component:||libc||Assignee:||Ulrich Drepper <drepper.fsp>|
|Attachments:||weak definitions testcase|
Description Samuel Thibault 2007-01-30 23:26:46 UTC
Attached is a testcase for weak references: two libraries define the safe symbol f, one as a weak definition, the other as a strong definition, and a program calls it. When run with ld-linux 2.3.6 and 2.5, the link order matters, while with ld-linux 2.2.5, the strong definition always wins. I would have expected to always get the 2.2.5's "strong always wins" behavior (and that's what I can read when googling), is there a reason for 2.3.6 and above to behave differently? (I can't see what weak definitions can be used for in such case).
Comment 1 Samuel Thibault 2007-01-30 23:27:14 UTC
Created attachment 1527 [details] weak definitions testcase
Comment 2 Ulrich Drepper 2007-01-31 01:06:15 UTC
Weak definition only and exclusively have a meaning for static archives. Old glibc versions mistakenly implemented it for dynamic linking, too. This is now not the default anymore. Broken code an use LD_DYNAMIC_WEAK.