This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PING^2: [PATCH] PR driver/81523: Make -static override -pie
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Alan Modra <amodra at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, "Joseph S. Myers" <joseph at codesourcery dot com>
- Date: Mon, 7 Aug 2017 09:02:42 -0700
- Subject: PING^2: [PATCH] PR driver/81523: Make -static override -pie
- Authentication-results: sourceware.org; auth=none
On Mon, Jul 31, 2017 at 7:04 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Mon, Jul 31, 2017 at 5:37 PM, Alan Modra <amodra@gmail.com> wrote:
>> On Mon, Jul 31, 2017 at 08:04:13AM -0700, H.J. Lu wrote:
>>> On Mon, Jul 24, 2017 at 10:24 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>> > On Sun, Jul 23, 2017 at 8:14 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>> >> -static and -pie together behave differently depending on whether GCC is
>>> >> configured with --enable-default-pie. On x86, "-static -pie" fails to
>>> >> create executable when --enable-default-pie isn't used, but creates a
>>> >> static executable when --enable-default-pie is used. This patch makes
>>> >> -static completely override -pie to create a static executable, regardless
>>> >> if --enable-default-pie is used to configure GCC.
>>> >>
>>> >> OK for master?
>>> >>
>>> >> H.J.
>>> >> --
>>> >> 2017-07-23 Alan Modra <amodra@gmail.com>
>>> >> H.J. Lu <hongjiu.lu@intel.com>
>>> >>
>>> >> gcc/
>>> >>
>>> >> PR driver/81523
>>> >> * gcc.c (NO_PIE_SPEC): Delete.
>>> >> (PIE_SPEC): Define as !no-pie/pie. Move static|shared|r
>>> >> exclusion..
>>> >> (LINK_PIE_SPEC): ..to here.
>>> >> * config/gnu-user.h (GNU_USER_TARGET_STARTFILE_SPEC): Correct
>>> >> chain of crtbegin*.o selection, update for PIE_SPEC changes and
>>> >> format.
>>> >> (GNU_USER_TARGET_ENDFILE_SPEC): Similarly.
>>> >> * config/sol2.h (STARTFILE_CRTBEGIN_SPEC): Similarly.
>>> >> (ENDFILE_CRTEND_SPEC): Similarly.
>>> >>
>>> >
>>> > We need to add %{no-pie:} to LINK_COMMAND_SPEC to prevent an error
>>> > message when PIE isn't enabled by default. Here is the updated patch with
>>> > a testcase.
>>> >
>>>
>>> PING. I am enclosing the patch here.
>>
>> For anyone looking at this, the patch enclosed here is mine from
>> https://gcc.gnu.org/ml/gcc-patches/2017-06/msg01678.html minus some PR
>> numbers and the powerpc specific part, plus testsuite (which looks to
>> me like HJ copied pie-static-1.c to pie-static-2.c then forgot to
>> change the order of -pie and -static), plus a tweak to
>> LINK_COMMAND_SPEC. The LINK_COMMAND_SPEC change looks good to me,
>> except for the comment which doesn't exactly match the code. That
>> change is necessary because I ignorantly removed %{no-pie:} from
>> LINK_PIE_SPEC without adding it back elsewhere.
>
> Here is the updated patch.
>
Hi Joseph,
Can you take a look at this patch:
https://gcc.gnu.org/ml/gcc-patches/2017-08/msg00011.html
Thanks.
--
H.J.