This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug driver/49371] xgcc: error: unrecognized option '-pie' on *-apple-darwin*
- From: "iains at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 11 Jun 2011 17:45:27 +0000
- Subject: [Bug driver/49371] xgcc: error: unrecognized option '-pie' on *-apple-darwin*
- Auto-submitted: auto-generated
- References: <bug-49371-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49371
--- Comment #7 from Iain Sandoe <iains at gcc dot gnu.org> 2011-06-11 17:44:13 UTC ---
(In reply to comment #6)
> If -pie is darwin9 later, shouldn't its passage to the linker be in darwin9.h
> instead?
yes, this will need sorting out too - darwin 8' s ld will barf on '-pie'.
so you could move the spec to darwin9.h --
- or maybe better put something like this (completely untested, not even
checked to compile)
Index: gcc/config/darwin.h
===================================================================
--- gcc/config/darwin.h (revision 174947)
+++ gcc/config/darwin.h (working copy)
@@ -226,6 +226,8 @@ extern GTY(()) int darwin_ms_struct;
#define LINK_SYSROOT_SPEC "%{isysroot*:-syslibroot %*}"
#endif
+#define PIE_SPEC "{-fpie|pie|fPIE:}"
+
/* Please keep the random linker options in alphabetical order (modulo
'Z' and 'no' prefixes). Note that options taking arguments may appear
multiple times on a command line with different arguments each time,
@@ -290,7 +292,7 @@ extern GTY(()) int darwin_ms_struct;
%:version-compare(< 10.5 mmacosx-version-min= -multiply_defined) \
%:version-compare(< 10.5 mmacosx-version-min= suppress)}} \
%{Zmultiplydefinedunused*:-multiply_defined_unused %*} \
- %{fpie:-pie} \
+ " PIE_SPEC " \
%{prebind} %{noprebind} %{nofixprebinding} %{prebind_all_twolevel_modules}
\
%{read_only_relocs} \
%{sectcreate*} %{sectorder*} %{seg1addr*} %{segprot*} \
Index: gcc/config/darwin9.h
===================================================================
--- gcc/config/darwin9.h (revision 174947)
+++ gcc/config/darwin9.h (working copy)
@@ -35,6 +35,9 @@ along with GCC; see the file COPYING3. If not see
/* Tell collect2 to run dsymutil for us as necessary. */
#define COLLECT_RUN_DSYMUTIL 1
+#undef PIE_SPEC
+#define PIE_SPEC "%{fpie|pie|fPIE:-pie}"
+
#undef ASM_OUTPUT_ALIGNED_COMMON
#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
do { \