This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch, Darwin] improve cross-compiles.


I've been experimenting with the idea of building native crosses on my most capable machine, for the many variants of darwin we now have, and then using the older/slower hardware for test only.

This has uncovered a few issues with cross/native cross flags etc.

this patch adjusts the mh-darwin fragment to ensure
(i)   that PIE is disabled for gcc exes on Darwin hosts since it is incompatible with the current PCH implementation.
(ii)  that -mdynamic-no-pic is used for m32 hosts.

… for crosses as well as bootstraps (and, also, for stage1 compilations when bootstrapping on a darwin host).

OK for trunk?
Iain

config:

	* mh-darwin (BOOT_CFLAGS): Only add -mdynamic-no-pic for m32 hosts.
	(STAGE1_CFLAGS, STAGE1_LDFLAGS): New.
	Fix over-length lines and amend comments.

diff --git a/config/mh-darwin b/config/mh-darwin
index 19bf265..a039f20 100644
--- a/config/mh-darwin
+++ b/config/mh-darwin
@@ -1,7 +1,18 @@
 # The -mdynamic-no-pic ensures that the compiler executable is built without
 # position-independent-code -- the usual default on Darwin. This fix speeds
 # compiles by 3-5%.
-BOOT_CFLAGS += -mdynamic-no-pic
+BOOT_CFLAGS += \
+`case ${host} in i?86-*-darwin* | powerpc-*-darwin*) \
+                 echo -mdynamic-no-pic ;; esac;`
 
-# Ensure we don't try and use -pie, as it is incompatible with pch.
-BOOT_LDFLAGS += `case ${host} in *-*-darwin[1][1-9]*) echo -Wl,-no_pie ;; esac;`
+# ld on Darwin versions >= 10.7 defaults to PIE executables. Disable this for
+# gcc components, since it is incompatible with our pch implementation.
+BOOT_LDFLAGS += \
+`case ${host} in *-*-darwin[1][1-9]*) echo -Wl,-no_pie ;; esac;`
+
+# Similarly, for cross-compilation.
+STAGE1_CFLAGS += \
+`case ${host} in i?86-*-darwin* | powerpc-*-darwin*)\
+                 echo -mdynamic-no-pic ;; esac;`
+STAGE1_LDFLAGS += \
+`case ${host} in *-*-darwin[1][1-9]*) echo -Wl,-no_pie ;; esac;`


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]