public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix PIE on netbsd (PR target/87221)
@ 2018-11-09  9:00 coypu
  2018-11-09 20:56 ` Jeff Law
  0 siblings, 1 reply; 2+ messages in thread
From: coypu @ 2018-11-09  9:00 UTC (permalink / raw)
  To: gcc-patches

Re-sending because my patch doesn't seem to appear on the archive


This matches to what netbsd is doing with its own copy of GCC,
it can be simpler.

PR target/87221:
config/netbsd-elf.h (NETBSD_STARTFILE_SPEC): use crtbeginS.o for PIE
(NETBSD_ENDFILE_SPEC): use crtendS.o for PIE

---
 gcc/config/netbsd-elf.h | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/gcc/config/netbsd-elf.h b/gcc/config/netbsd-elf.h
index 4dc2aa757..26e5d996e 100644
--- a/gcc/config/netbsd-elf.h
+++ b/gcc/config/netbsd-elf.h
@@ -40,8 +40,11 @@ along with GCC; see the file COPYING3.  If not see
        %{!p:crt0%O%s}}}		\
    %:if-exists(crti%O%s)	\
    %{static:%:if-exists-else(crtbeginT%O%s crtbegin%O%s)} \
-   %{!static: \
-     %{!shared:crtbegin%O%s} %{shared:crtbeginS%O%s}}"
+   %{!static:                   \
+     %{!shared:                 \
+       %{!pie:crtbegin%O%s}     \
+       %{pie:crtbeginS%O%s}}    \
+     %{shared:crtbeginS%O%s}}"
 
 #undef STARTFILE_SPEC
 #define STARTFILE_SPEC NETBSD_STARTFILE_SPEC
@@ -52,7 +55,10 @@ along with GCC; see the file COPYING3.  If not see
    C++ file-scope static objects deconstructed after exiting "main".  */
 
 #define NETBSD_ENDFILE_SPEC	\
-  "%{!shared:crtend%O%s} %{shared:crtendS%O%s} \
+  "%{!shared:                   \
+    %{!pie:crtend%O%s}          \
+    %{pie:crtendS%O%s}}         \
+   %{shared:crtendS%O%s}        \
    %:if-exists(crtn%O%s)"
 
 #undef ENDFILE_SPEC
-- 
2.19.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix PIE on netbsd (PR target/87221)
  2018-11-09  9:00 [PATCH] Fix PIE on netbsd (PR target/87221) coypu
@ 2018-11-09 20:56 ` Jeff Law
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2018-11-09 20:56 UTC (permalink / raw)
  To: coypu, gcc-patches

On 11/9/18 1:59 AM, coypu@sdf.org wrote:
> Re-sending because my patch doesn't seem to appear on the archive
> 
> 
> This matches to what netbsd is doing with its own copy of GCC,
> it can be simpler.
> 
> PR target/87221:
> config/netbsd-elf.h (NETBSD_STARTFILE_SPEC): use crtbeginS.o for PIE
> (NETBSD_ENDFILE_SPEC): use crtendS.o for PIE
Thanks.  Installed on the trunk.
jeff

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-11-09 20:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-09  9:00 [PATCH] Fix PIE on netbsd (PR target/87221) coypu
2018-11-09 20:56 ` Jeff Law

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).