This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] PR ld/19636: [x86] Resolve undefweak and defined symbols in executable
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Michael Matz <matz at suse dot de>
- Cc: Binutils <binutils at sourceware dot org>
- Date: Wed, 24 Feb 2016 09:21:12 -0800
- Subject: Re: [PATCH] PR ld/19636: [x86] Resolve undefweak and defined symbols in executable
- Authentication-results: sourceware.org; auth=none
- References: <20160223175814 dot GA2858 at intel dot com> <alpine dot LSU dot 2 dot 20 dot 1602241541430 dot 20277 at wotan dot suse dot de> <CAMe9rOoxU43=dhGYZZGQtWhfbU-sGRoaiiJ7PfPNtzSc05-t-A at mail dot gmail dot com> <alpine dot LSU dot 2 dot 20 dot 1602241552020 dot 20277 at wotan dot suse dot de> <CAMe9rOpEWKVVP=-o0t0emkjKR0-xqnn-YZ5C5nfa=0E4BkEZaw at mail dot gmail dot com> <alpine dot LSU dot 2 dot 20 dot 1602241709410 dot 20277 at wotan dot suse dot de> <CAMe9rOr5qa_PBJA3oDENWErRfrojtzC1ncXaWwyh-1EAczPn-g at mail dot gmail dot com> <alpine dot LSU dot 2 dot 20 dot 1602241749340 dot 20277 at wotan dot suse dot de> <CAMe9rOrSNYV_x-5aU7K+hXHNrinE9Co8y1F5VUkY+SoRQize=g at mail dot gmail dot com> <alpine dot LSU dot 2 dot 20 dot 1602241753490 dot 20277 at wotan dot suse dot de> <CAMe9rOpZNHtKRvx+5QurEOcVU96WEQuBRPJ6UorocjE-8Jd+vQ at mail dot gmail dot com> <alpine dot LSU dot 2 dot 20 dot 1602241808400 dot 20277 at wotan dot suse dot de>
On Wed, Feb 24, 2016 at 9:11 AM, Michael Matz <matz@suse.de> wrote:
> Hi,
>
> On Wed, 24 Feb 2016, H.J. Lu wrote:
>
>> > I can't fathom why anyone would call the above behaviour unexpected or
>> > broken, or would desire the above to _not_ print "works".
>>
>> This is the unintended behavior
>
> Can you cite something to support this statement? Is everyone here of
> this opinion?
>
Weak symbol was introduced for system libraries. gABI has "Unresolved
weak symbols have a zero value." and
The behavior of weak symbols in areas not specified by this document
is implementation defined. Weak symbols are intended primarily for use
in system software. Applications using weak symbols are unreliable
since changes in the runtime environment might cause the execution to
fail.
Ld at link-time and ld.so at run-time do want to use vale 0 for unresolved
weak symbols. We used to treat STB_WEAK differently in ld.so and later
changed to treat STB_WEAK the same as STB_GLOBAL for defined
symbols, i.e. there are no weak defined symbols at run-time.
--
H.J.