[PATCH] Enable PIE for sh-linux
kaz Kojima
kkojima@rr.iij4u.or.jp
Wed Jun 4 11:47:00 GMT 2003
Hi,
Here is an SH portion of jakub's PIE patch:
<URL:http://gcc.gnu.org/ml/gcc-patches/2003-06/msg00140.html>.
It affects sh*-linux targets only. I don't do it for sh/elf.h,
since embedded sh elf targets wouldn't need PIE at present and
sh netbsd folks might want their own STARTFILE_SPEC.
Bootstrapped and regtested on sh4-unknown-linux-gnu with no new
regressions. I'd like to check it in if there are no comments.
Regards,
kaz
--
2003-06-04 Kaz Kojima <kkojima@gcc.gnu.org>
* config/sh/linux.h (STARTFILE_SPEC): Handle -pie. Simplify.
(ENDFILE_SPEC): Redefine to handle -pie.
diff -u3prN ORIG/gcc/gcc/config/sh/linux.h LOCAL/gcc/gcc/config/sh/linux.h
--- ORIG/gcc/gcc/config/sh/linux.h Fri Feb 14 12:32:23 2003
+++ LOCAL/gcc/gcc/config/sh/linux.h Wed Jun 4 06:28:45 2003
@@ -88,12 +88,19 @@ do { \
#endif
#undef STARTFILE_SPEC
+#if defined HAVE_LD_PIE
#define STARTFILE_SPEC \
- "%{!shared: \
- %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} \
- %{!p:%{profile:gcrt1.o%s} \
- %{!profile:crt1.o%s}}}} \
- crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
+ "%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
+ crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
+#else
+#define STARTFILE_SPEC \
+ "%{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}} \
+ crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
+#endif
+
+#undef ENDFILE_SPEC
+#define ENDFILE_SPEC \
+ "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
/* Output assembler code to STREAM to call the profiler. */
More information about the Gcc-patches
mailing list