This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PATCH: PR ld/16428: Disallow -shared/-pie, -shared/-static, -pie/-static
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: "Joseph S. Myers" <joseph at codesourcery dot com>
- Cc: Cary Coutant <ccoutant at google dot com>, GCC Development <gcc at gcc dot gnu dot org>, Binutils <binutils at sourceware dot org>
- Date: Tue, 14 Jan 2014 13:57:54 -0800
- Subject: Re: PATCH: PR ld/16428: Disallow -shared/-pie, -shared/-static, -pie/-static
- Authentication-results: sourceware.org; auth=none
- References: <20140110142001 dot GA6035 at intel dot com> <20140111001259 dot GE5390 at bubble dot grove dot modra dot org> <CAMe9rOo0UtpbdT69cnkK4fZD5pmzQnuX2wMCkBy3GuSLGcmcow at mail dot gmail dot com> <CAHACq4opdALo+T=dvM_PT2M36H+feAqpF6Gsf0sPZy-g=bg8SA at mail dot gmail dot com> <20140114003945 dot GM5390 at bubble dot grove dot modra dot org> <CAHACq4oq4KjUqc8GTgA6onRBQBxyvfxDcQn6OmCC7mrRu04_Aw at mail dot gmail dot com> <CAMe9rOooXfygAUg--xG=XtPpo56kOz0B9sm70zBDhZz+9scm9Q at mail dot gmail dot com> <Pine dot LNX dot 4 dot 64 dot 1401141928050 dot 8844 at digraph dot polyomino dot org dot uk> <CAMe9rOqSdNKEogCbSEAiJV+1yHtCgN4O+zCewCSaXaFDOqUJ5g at mail dot gmail dot com> <Pine dot LNX dot 4 dot 64 dot 1401142143400 dot 10324 at digraph dot polyomino dot org dot uk>
On Tue, Jan 14, 2014 at 1:45 PM, Joseph S. Myers
<joseph@codesourcery.com> wrote:
> On Tue, 14 Jan 2014, H.J. Lu wrote:
>
>> On Tue, Jan 14, 2014 at 11:37 AM, Joseph S. Myers
>> <joseph@codesourcery.com> wrote:
>> > On Tue, 14 Jan 2014, H.J. Lu wrote:
>> >
>> >> When there is -static, -dynamic-linker won't passed to ld. -static,
>> >> -shared, -pie should be mutually exclusive for GCC driver.
>> >
>> > A static PIE shouldn't specify an interpreter; it should handle all
>> > dynamic relocation processing itself. Thus, it's correct not to specify
>> > -dynamic-linker when building a static PIE.
>>
>> If -dynamic-linker isn't specified, linker will use
>> the default dynamic linker:
>
> I'd say that's a bug in ld - that it shouldn't specify an interpreter at
> all (that the startup code / libc for static PIEs needs to include all the
> relevant parts of the dynamic linker to make the binary relocate itself).
>
The -static part of "-static -pie" passed to linker tells linker
searches libfoo.a, not libfoo.so for -lfoo. You can add
-Bdynamic to change it for latter inputs. It has nothing to do
if interpreter is used or not.
--
H.J.
- References:
- PATCH: PR ld/16428: Disallow -shared/-pie, -shared/-static, -pie/-static
- Re: PATCH: PR ld/16428: Disallow -shared/-pie, -shared/-static, -pie/-static
- Re: PATCH: PR ld/16428: Disallow -shared/-pie, -shared/-static, -pie/-static
- Re: PATCH: PR ld/16428: Disallow -shared/-pie, -shared/-static, -pie/-static
- Re: PATCH: PR ld/16428: Disallow -shared/-pie, -shared/-static, -pie/-static
- Re: PATCH: PR ld/16428: Disallow -shared/-pie, -shared/-static, -pie/-static
- Re: PATCH: PR ld/16428: Disallow -shared/-pie, -shared/-static, -pie/-static
- Re: PATCH: PR ld/16428: Disallow -shared/-pie, -shared/-static, -pie/-static
- Re: PATCH: PR ld/16428: Disallow -shared/-pie, -shared/-static, -pie/-static
- Re: PATCH: PR ld/16428: Disallow -shared/-pie, -shared/-static, -pie/-static