diff mbox series

Fix PIE on netbsd (PR target/87221)

Message ID 20181109085943.GA3056@SDF.ORG
State New
Headers show
Series Fix PIE on netbsd (PR target/87221) | expand

Commit Message

Maya Rashish Nov. 9, 2018, 8:59 a.m. UTC
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(-)

Comments

Jeff Law Nov. 9, 2018, 8:56 p.m. UTC | #1
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
diff mbox series

Patch

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