From: Fangrui Song <maskray@google.com>
To: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Cc: "H.J. Lu" <hjl.tools@gmail.com>,
Florian Weimer <fweimer@redhat.com>,
Wilco Dijkstra via Libc-alpha <libc-alpha@sourceware.org>
Subject: Re: [RESEND PATCH] Makeconfig: Set pie-ccflag to -fPIE by default
Date: Thu, 15 Sep 2022 14:45:13 -0700 [thread overview]
Message-ID: <20220915214513.s6uzsy2zvcnevolx@google.com> (raw)
In-Reply-To: <AS4PR08MB7901EE418E1C49C81F06E162837C9@AS4PR08MB7901.eurprd08.prod.outlook.com>
On 2022-09-05, Wilco Dijkstra wrote:
>Hi,
>
>>>> Right, so it should be safe then to mark all symbols as hidden.
>>>>
>>>> We could also teach GCC to never emit GOT indirections with -fPIE -static
>>>> (the only reason to use a GOT indirection is to avoid copy relocations in
>>>> dynamically linked binaries).
>>>>
>>>
>>>But -static isn't passed to cc1.
>
>The driver could just pass it or change -fPIE into a new -fstatic-PIE.
>
>> With Clang, -fPIE -fno-direct-access-external-data can be used.
>> See https://maskray.me/blog/2021-01-09-copy-relocations-canonical-plt-entries-and-protected
>>
>> GCC's x86 port went with -mdirect-extern-access.
>
>Well ideally we'd have the same option that works in both compilers - it's likely easy to
>support in GCC.
>
>It would be great to also have something like -ffast-PIC that implies -fno-semantic-interposition
>since 99% of the time you don't need semantic interposition.
>
>Cheers,
>Wilco
In Clang, -fpic/-fPIC without -fno-semantic-interposition still allows
interprocedural optimizations of default visibility external linkage definitions.
It is unfortunate that GCC doesn't allow it and
--enable-default-semantic-interposition is rejected (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100937)
So if such an option -ffast-PIC is made, it will only benefit GCC.
I have a long write-up in https://maskray.me/blog/2021-05-09-fno-semantic-interposition#in-action
next prev parent reply other threads:[~2022-09-15 21:45 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-26 18:39 Wilco Dijkstra
2022-08-26 19:02 ` H.J. Lu
2022-08-26 19:45 ` Richard Henderson
2022-08-26 20:11 ` H.J. Lu
2022-08-29 11:49 ` Wilco Dijkstra
2022-08-29 13:10 ` Florian Weimer
2022-08-29 15:27 ` Wilco Dijkstra
2022-08-29 15:27 ` Wilco Dijkstra
2022-08-29 19:43 ` H.J. Lu
2022-08-29 19:57 ` Fangrui Song
2022-09-05 8:58 ` Wilco Dijkstra
2022-09-15 21:45 ` Fangrui Song [this message]
2022-09-20 13:59 ` Wilco Dijkstra
2022-09-20 14:12 ` Florian Weimer
2022-09-20 16:00 ` Wilco Dijkstra
2022-09-20 22:02 ` Fangrui Song
-- strict thread matches above, loose matches on Subject: below --
2022-08-25 21:01 Richard Henderson
2022-08-26 12:32 ` Adhemerval Zanella Netto
2022-08-26 17:29 ` Richard Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220915214513.s6uzsy2zvcnevolx@google.com \
--to=maskray@google.com \
--cc=Wilco.Dijkstra@arm.com \
--cc=fweimer@redhat.com \
--cc=hjl.tools@gmail.com \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).