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: Alan Modra <amodra at gmail dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: binutils at sourceware dot org
- Date: Wed, 24 Feb 2016 12:09:09 +1030
- 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>
On Tue, Feb 23, 2016 at 09:58:14AM -0800, H.J. Lu wrote:
> For i386 and x86-64, undefined weak and defined symbols are resolved
> without dynamic relocation when creating executable. Undefined weak
> symbols aren't needed in the dynamic symbol table in executable. One
> exception is on i386, we need undefined weak symbols in the dynamic
> symbol table in PIE if input relocatable files contain branchs without
> PLT so that we can branch to 0 with dynamic relocation in text section.
>
> This makes behaviors of static excutable, dynamic excutable and position
> independent executable consistent with references to undefined weak and
> defined symbols, regardless if the relocatable input is compiled with
> PIC or not.
People know that PIC and non-PIC are different on x86 and many other
architectures. For example, a quick google search turns up
https://glandium.org/blog/?p=2764
"On Linux systems, this just works. Compile the program (youâll need
to build it with -fPIC, though)..."
I've seen other references to this feature, which you will break with
your patch. Quite frankly, if this is new to you, as you say in
https://sourceware.org/ml/binutils/2016-02/msg00290.html then you
should not be rushing so quickly into this change.
--
Alan Modra
Australia Development Lab, IBM