Sources Bugzilla – Bug 3946
Weak definitions aren't so weak
Last modified: 2007-01-31 01:06:15 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).
Created attachment 1527 [details]
weak definitions testcase
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.