This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] m32r-linux-gcc support for position independent executables
- From: Kazuhiro Inaoka <inaoka dot kazuhiro at renesas dot com>
- To: Nick Clifton <nickc at redhat dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 08 Jul 2005 16:07:22 +0900
- Subject: [PATCH] m32r-linux-gcc support for position independent executables
Hi Nick,
Thease patches are to support pie.
Please commit it.
Regards,
Kazuhiro Inaoka
gcc/ChangeLog
2005-07-08 Kazuhiro Inaoka <inaoka.kazuhiro@renesas.com>
* config/m32r/linux.h (STARTFILE_SPEC): Support PIE.
(ENDFILE_SPEC): Ditto.
* config/m32r/m32r.h (ASM_SPEC): Ditto.
Index: m32r.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m32r/m32r.h,v
retrieving revision 1.132
diff -u -r1.132 m32r.h
--- m32r.h 5 Jul 2005 14:16:06 -0000 1.132
+++ m32r.h 8 Jul 2005 06:14:18 -0000
@@ -183,7 +183,7 @@
/* Options to pass on to the assembler. */
#undef ASM_SPEC
-#define ASM_SPEC "%{v} %(asm_cpu) %(relax) %{fpic:-K PIC} %{fPIC:-K PIC}"
+#define ASM_SPEC "%{v} %(asm_cpu) %(relax) %{fpic|fpie:-K PIC} %{fPIC|fPIE:-K PIC}"
#define LINK_SPEC "%{v} %(link_cpu) %(relax)"
Index: linux.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m32r/linux.h,v
retrieving revision 1.5
diff -u -r1.5 linux.h
--- linux.h 25 Jun 2005 01:21:31 -0000 1.5
+++ linux.h 8 Jul 2005 06:14:18 -0000
@@ -85,14 +85,20 @@
%{profile:-lc_p} %{!profile: -lc}}"
#undef STARTFILE_SPEC
+#if defined HAVE_LD_PIE
+#define STARTFILE_SPEC \
+ "%{!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:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}}\
crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
+#endif
#undef ENDFILE_SPEC
#define ENDFILE_SPEC \
- "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
+ "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
#undef SUBTARGET_CPP_SPEC
#define SUBTARGET_CPP_SPEC "\