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: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: "H.J. Lu" <hjl dot tools at gmail 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 19:37:16 +0000
- 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>
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.
ld.so itself is a static PIE - it specifies no PT_INTERP or DT_NEEDED, and
is position-independent. The concept of an arbitrary program meeting
those conditions, including a copy of the relevant parts of the dynamic
linker to relocate itself, is perfectly meaningful; it just so happens
that glibc, and the associated GCC specs, don't support it, but I'm not
aware of any fundamental problem with supporting it in ld given
appropriate startup code and static libc built as PIC. (I don't know how
useful more general static PIE support would be.)
(-shared and -pie do seem mutually exclusive, as the first says what's
being linked operates as a library and the second says it operates as an
executable - although of course the same ET_DYN can operate as both.)
--
Joseph S. Myers
joseph@codesourcery.com
- 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