* [PATCH] Use Pcrt1.o%s/gPcrt1.o%s for -static-pie
@ 2017-10-15 18:09 H.J. Lu
2017-11-01 16:32 ` Rich Felker
0 siblings, 1 reply; 3+ messages in thread
From: H.J. Lu @ 2017-10-15 18:09 UTC (permalink / raw)
To: gcc-patches; +Cc: Joseph Myers
crt1.o is used to create dynamic and non-PIE static executables. Static
PIE needs to link with Pcrt1.o, instead of crt1.o, to relocate static PIE
at run-time. When -pg is used with -static-pie, gPcrt1.o should be used.
Tested on x86-64. OK for master?
Thanks.
H.J.
---
* config/gnu-user.h (GNU_USER_TARGET_STARTFILE_SPEC): Use
Pcrt1.o%s/gPcrt1.o%s for -static-pie.
---
gcc/config/gnu-user.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/gcc/config/gnu-user.h b/gcc/config/gnu-user.h
index a967b69a350..c1cfdc3da90 100644
--- a/gcc/config/gnu-user.h
+++ b/gcc/config/gnu-user.h
@@ -51,9 +51,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#if defined HAVE_LD_PIE
#define GNU_USER_TARGET_STARTFILE_SPEC \
"%{shared:; \
- pg|p|profile:gcrt1.o%s; \
+ pg|p|profile:%{static-pie:gPcrt1.o%s;:gcrt1.o%s}; \
static:crt1.o%s; \
- static-pie|" PIE_SPEC ":Scrt1.o%s; \
+ static-pie:Pcrt1.o%s; \
+ " PIE_SPEC ":Scrt1.o%s; \
:crt1.o%s} \
crti.o%s \
%{static:crtbeginT.o%s; \
--
2.13.5
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Use Pcrt1.o%s/gPcrt1.o%s for -static-pie
2017-10-15 18:09 [PATCH] Use Pcrt1.o%s/gPcrt1.o%s for -static-pie H.J. Lu
@ 2017-11-01 16:32 ` Rich Felker
2017-11-01 16:39 ` H.J. Lu
0 siblings, 1 reply; 3+ messages in thread
From: Rich Felker @ 2017-11-01 16:32 UTC (permalink / raw)
To: H.J. Lu; +Cc: gcc-patches, Joseph Myers
On Sun, Oct 15, 2017 at 06:16:57AM -0700, H.J. Lu wrote:
> crt1.o is used to create dynamic and non-PIE static executables. Static
> PIE needs to link with Pcrt1.o, instead of crt1.o, to relocate static PIE
> at run-time. When -pg is used with -static-pie, gPcrt1.o should be used.
>
> Tested on x86-64. OK for master?
Is there a reason you didn't follow the existing naming practice here?
Openbsd and musl libc have both had static pie for a long time now and
have used rcrt1.o as the name.
Rich
> ---
> * config/gnu-user.h (GNU_USER_TARGET_STARTFILE_SPEC): Use
> Pcrt1.o%s/gPcrt1.o%s for -static-pie.
> ---
> gcc/config/gnu-user.h | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/gcc/config/gnu-user.h b/gcc/config/gnu-user.h
> index a967b69a350..c1cfdc3da90 100644
> --- a/gcc/config/gnu-user.h
> +++ b/gcc/config/gnu-user.h
> @@ -51,9 +51,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
> #if defined HAVE_LD_PIE
> #define GNU_USER_TARGET_STARTFILE_SPEC \
> "%{shared:; \
> - pg|p|profile:gcrt1.o%s; \
> + pg|p|profile:%{static-pie:gPcrt1.o%s;:gcrt1.o%s}; \
> static:crt1.o%s; \
> - static-pie|" PIE_SPEC ":Scrt1.o%s; \
> + static-pie:Pcrt1.o%s; \
> + " PIE_SPEC ":Scrt1.o%s; \
> :crt1.o%s} \
> crti.o%s \
> %{static:crtbeginT.o%s; \
> --
> 2.13.5
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Use Pcrt1.o%s/gPcrt1.o%s for -static-pie
2017-11-01 16:32 ` Rich Felker
@ 2017-11-01 16:39 ` H.J. Lu
0 siblings, 0 replies; 3+ messages in thread
From: H.J. Lu @ 2017-11-01 16:39 UTC (permalink / raw)
To: Rich Felker; +Cc: GCC Patches, Joseph Myers
On Wed, Nov 1, 2017 at 9:32 AM, Rich Felker <dalias@libc.org> wrote:
> On Sun, Oct 15, 2017 at 06:16:57AM -0700, H.J. Lu wrote:
>> crt1.o is used to create dynamic and non-PIE static executables. Static
>> PIE needs to link with Pcrt1.o, instead of crt1.o, to relocate static PIE
>> at run-time. When -pg is used with -static-pie, gPcrt1.o should be used.
>>
>> Tested on x86-64. OK for master?
>
> Is there a reason you didn't follow the existing naming practice here?
> Openbsd and musl libc have both had static pie for a long time now and
> have used rcrt1.o as the name.
I wasn't aware of rcrt1.o and there is no reference to rcrt1.o in GCC at all.
Does the FSF GCC support static PIE for musl libc? If not, is there a GCC
bug for it?
BTW, I don't mind replacing Pcrt1.o/gPcrt1.o with rcrt1.o/grcrt1.o.
--
H.J.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-11-01 16:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-15 18:09 [PATCH] Use Pcrt1.o%s/gPcrt1.o%s for -static-pie H.J. Lu
2017-11-01 16:32 ` Rich Felker
2017-11-01 16:39 ` H.J. Lu
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).