* [RS6000] linux startfile/endfile
@ 2017-08-11 3:10 Alan Modra
2017-08-12 8:28 ` Segher Boessenkool
0 siblings, 1 reply; 2+ messages in thread
From: Alan Modra @ 2017-08-11 3:10 UTC (permalink / raw)
To: gcc-patches; +Cc: Segher Boessenkool
These need to match the gnu-user.h definitions to support
--enable-default-pie. Otherwise we end up linking the wrong startup
files when defaulting to PIE.
I've just copied the HAVE_LD_PIE variants as we don't need the
!HAVE_LD_PIE variant. (In fact, gnu-user.h doesn't need them either.)
Bootstrapped and regression tested powerpc64-linux and
powerpc64le-linux. OK?
PR target/81170
PR target/81295
* config/rs6000/sysv4.h (STARTFILE_LINUX_SPEC): Upgrade to
match gnu-user.h startfile.
(ENDFILE_LINUX_SPEC): Similarly.
diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h
index de38629..cbee891 100644
--- a/gcc/config/rs6000/sysv4.h
+++ b/gcc/config/rs6000/sysv4.h
@@ -757,24 +757,34 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEFAULT_ASM_ENDIAN)
#define CRTOFFLOADEND ""
#endif
-#ifdef HAVE_LD_PIE
-#define STARTFILE_LINUX_SPEC "\
-%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
-%{mnewlib:ecrti.o%s;:crti.o%s} \
-%{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s} \
-" CRTOFFLOADBEGIN
-#else
-#define STARTFILE_LINUX_SPEC "\
-%{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}} \
-%{mnewlib:ecrti.o%s;:crti.o%s} \
-%{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s} \
-" CRTOFFLOADBEGIN
-#endif
-
-#define ENDFILE_LINUX_SPEC "\
-%{shared|pie:crtendS.o%s;:crtend.o%s} \
-%{mnewlib:ecrtn.o%s;:crtn.o%s} \
-" CRTOFFLOADEND
+/* STARTFILE_LINUX_SPEC should be the same as GNU_USER_TARGET_STARTFILE_SPEC
+ but with the mnewlib ecrti.o%s selection substituted for crti.o%s. */
+#define STARTFILE_LINUX_SPEC \
+ "%{shared:; \
+ pg|p|profile:gcrt1.o%s; \
+ static:crt1.o%s; \
+ " PIE_SPEC ":Scrt1.o%s; \
+ :crt1.o%s} \
+ %{mnewlib:ecrti.o%s;:crti.o%s} \
+ %{static:crtbeginT.o%s; \
+ shared|" PIE_SPEC ":crtbeginS.o%s; \
+ :crtbegin.o%s} \
+ %{fvtable-verify=none:%s; \
+ fvtable-verify=preinit:vtv_start_preinit.o%s; \
+ fvtable-verify=std:vtv_start.o%s} \
+ " CRTOFFLOADBEGIN
+
+/* ENDFILE_LINUX_SPEC should be the same as GNU_USER_TARGET_ENDFILE_SPEC
+ but with the mnewlib ecrtn.o%s selection substituted for crtn.o%s. */
+#define ENDFILE_LINUX_SPEC \
+ "%{fvtable-verify=none:%s; \
+ fvtable-verify=preinit:vtv_end_preinit.o%s; \
+ fvtable-verify=std:vtv_end.o%s} \
+ %{static:crtend.o%s; \
+ shared|" PIE_SPEC ":crtendS.o%s; \
+ :crtend.o%s} \
+ %{mnewlib:ecrtn.o%s;:crtn.o%s} \
+ " CRTOFFLOADEND
#define LINK_START_LINUX_SPEC ""
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [RS6000] linux startfile/endfile
2017-08-11 3:10 [RS6000] linux startfile/endfile Alan Modra
@ 2017-08-12 8:28 ` Segher Boessenkool
0 siblings, 0 replies; 2+ messages in thread
From: Segher Boessenkool @ 2017-08-12 8:28 UTC (permalink / raw)
To: Alan Modra; +Cc: gcc-patches
On Fri, Aug 11, 2017 at 12:23:26PM +0930, Alan Modra wrote:
> These need to match the gnu-user.h definitions to support
> --enable-default-pie. Otherwise we end up linking the wrong startup
> files when defaulting to PIE.
>
> I've just copied the HAVE_LD_PIE variants as we don't need the
> !HAVE_LD_PIE variant. (In fact, gnu-user.h doesn't need them either.)
>
> Bootstrapped and regression tested powerpc64-linux and
> powerpc64le-linux. OK?
Okay for trunk, and backports if you need/want them (do you?) Thanks,
Segher
> PR target/81170
> PR target/81295
> * config/rs6000/sysv4.h (STARTFILE_LINUX_SPEC): Upgrade to
> match gnu-user.h startfile.
> (ENDFILE_LINUX_SPEC): Similarly.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-08-11 22:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-11 3:10 [RS6000] linux startfile/endfile Alan Modra
2017-08-12 8:28 ` Segher Boessenkool
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).