This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: --as-needed change wrt undefined weak symbols
- From: Alan Modra <amodra at gmail dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: Binutils <binutils at sourceware dot org>
- Date: Fri, 5 Apr 2013 11:37:22 +1030
- Subject: Re: --as-needed change wrt undefined weak symbols
- References: <20130114035805 dot GF3244 at bubble dot grove dot modra dot org> <CAMe9rOr9pmgn=ARZn_kEcJvAm4yHpyDmgxq=7_XHRVs7pzOopQ at mail dot gmail dot com> <20130115022340 dot GO3244 at bubble dot grove dot modra dot org> <CAMe9rOrOBPOHkQpPzYjC=OBgwq4bF29zDTTWidW20RJ5Y-F3tA at mail dot gmail dot com> <20130115052328 dot GQ3244 at bubble dot grove dot modra dot org> <CAMe9rOqcu7_-aAkkF=im56KsQ9Ypb6YkmmogcZDoswkNsaPPqg at mail dot gmail dot com> <20130318024130 dot GA18331 at bubble dot grove dot modra dot org> <CAMe9rOqy-OCgK44rPHK8BsiGpQcf1vzbXnsjcioNO7tFDSADTA at mail dot gmail dot com> <20130404223932 dot GH27605 at bubble dot grove dot modra dot org> <CAMe9rOo0biV9eNR2Cv1e+QsBaRa+vFddKydL7e9gQCz65hLymA at mail dot gmail dot com>
On Thu, Apr 04, 2013 at 04:11:54PM -0700, H.J. Lu wrote:
> It is resolved to either 0, if it is undefined, or its PLT entry, if
> it is defined. Once it is resolved to 0 at link-time, change to
> defined at run-time won't affect executable. If it is resolved
> to defined at link-time, change it to undefined at run-time
> will lead to seg-fault.
Yes, that is a problem with any target that resolves function
addresses to a PLT entry. For such targets, this is generally true
for any usage of weak functions in a non-PIC executable. In other
words, the problem you raise here is entirely orthogonal to
--as-needed behaviour.
--
Alan Modra
Australia Development Lab, IBM