Bug 3946 - Weak definitions aren't so weak
Summary: Weak definitions aren't so weak
Status: RESOLVED INVALID
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: 2.3.6
: P2 normal
Target Milestone: ---
Assignee: Ulrich Drepper
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-01-30 23:26 UTC by Samuel Thibault
Modified: 2018-04-20 14:02 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments
weak definitions testcase (466 bytes, application/octet-stream)
2007-01-30 23:27 UTC, Samuel Thibault
Details

Note You need to log in before you can comment on or make changes to this bug.
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.