This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Pass -fpie to the Darwin linker
- From: gkeating at apple dot com (Geoffrey Keating)
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 1 Jun 2007 15:57:05 -0700 (PDT)
- Subject: Pass -fpie to the Darwin linker
Pretty obvious. I added the testcase because there doesn't seem to be
any test that involves linking a PIE executable.
Bootstrapped and tested on powerpc-darwin8. I also checked that GCC
does try to pass -pie to the linker.
--
- Geoffrey Keating <geoffk@apple.com>
===File ~/patches/gcc-darwin-5238485.patch==================
2007-06-01 Geoffrey Keating <geoffk@apple.com>
* config/darwin.h (LINK_SPEC): Pass -fpie through to the linker.
Index: testsuite/ChangeLog
2007-06-01 Geoffrey Keating <geoffk@apple.com>
* gcc.dg/pie-link.c: New test.
Index: config/darwin.h
===================================================================
--- config/darwin.h (revision 125212)
+++ config/darwin.h (working copy)
@@ -307,6 +307,7 @@
%:version-compare(< 10.5 mmacosx-version-min= -multiply_defined) \
%:version-compare(< 10.5 mmacosx-version-min= suppress)}} \
%{Zmultiplydefinedunused*:-multiply_defined_unused %*} \
+ %{fpie:-pie} \
%{prebind} %{noprebind} %{nofixprebinding} %{prebind_all_twolevel_modules} \
%{read_only_relocs} \
%{sectcreate*} %{sectorder*} %{seg1addr*} %{segprot*} \
Index: testsuite/gcc.dg/pie-link.c
===================================================================
--- testsuite/gcc.dg/pie-link.c (revision 0)
+++ testsuite/gcc.dg/pie-link.c (revision 0)
@@ -0,0 +1,7 @@
+/* { dg-do link { target *-*-darwin[912]* *-*-linux* } } */
+/* { dg-options "-fpie" } */
+
+int main(void)
+{
+ return 0;
+}
============================================================