Patchwork [Darwin] improve cross-compiles.

login
register
mail settings
Submitter Iain Sandoe
Date Sept. 28, 2013, 9:35 a.m.
Message ID <BBB7C376-19BC-4540-B71D-CAF174D89192@codesourcery.com>
Download mbox | patch
Permalink /patch/278726/
State New
Headers show

Comments

Iain Sandoe - Sept. 28, 2013, 9:35 a.m.
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.
Mike Stump - Sept. 29, 2013, 5:31 p.m.
On Sep 28, 2013, at 2:35 AM, Iain Sandoe <iain@codesourcery.com> wrote:
> 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.

> (i)   that PIE is disabled for gcc exes on Darwin hosts since it is incompatible with the current PCH implementation.

Yup.

> (ii)  that -mdynamic-no-pic is used for m32 hosts.

RIght.

> OK for trunk?

Ok.

Patch

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;`