aboutsummaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2015-04-10 08:43:52 +0200
committerIain Sandoe <iains@gcc.gnu.org>2015-04-10 06:43:52 +0000
commitcacf1f59069873d69005fd274184adc25da3bc90 (patch)
tree7b815277dd56cf4c4aa0686897089fe68d9e2937 /config
parentc620a1686faf1e546d292515be12f3c94421e212 (diff)
downloadgcc-cacf1f59069873d69005fd274184adc25da3bc90.zip
gcc-cacf1f59069873d69005fd274184adc25da3bc90.tar.gz
gcc-cacf1f59069873d69005fd274184adc25da3bc90.tar.bz2
re PR target/65351 (libiberty's pic version contains non-pic code on m32 darwin; causes bootstrap fail building libcc1.)
PR target/65351 config/ * mh-darwin: Only apply -mdynamic-no-pic for m32 Darwin when the compiler in use supports -mno-dynamic-no-pic. * picflag.m4: Only append -mno-dynamic-no-pic for Darwin when -mdynamic-no-pic is present in CFLAGS. libiberty/ * configure: Regenerate. libada/ * configure: Regenerate. libgcc/ * configure: Regenerate. gcc/ * configure: Regenerate. Co-Authored-By: Iain Sandoe <iain@codesourcery.com> From-SVN: r221967
Diffstat (limited to 'config')
-rw-r--r--config/ChangeLog9
-rw-r--r--config/mh-darwin31
-rw-r--r--config/picflag.m414
3 files changed, 39 insertions, 15 deletions
diff --git a/config/ChangeLog b/config/ChangeLog
index 08b9c8d..a2225cd 100644
--- a/config/ChangeLog
+++ b/config/ChangeLog
@@ -1,3 +1,12 @@
+2015-04-10 Jakub Jelinek <jakub@redhat.com>
+ Iain Sandoe <iain@codesourcery.com>
+
+ PR target/65351
+ * mh-darwin: Only apply -mdynamic-no-pic for m32 Darwin when the
+ compiler in use supports -mno-dynamic-no-pic.
+ * picflag.m4: Only append -mno-dynamic-no-pic for Darwin when
+ -mdynamic-no-pic is present in CFLAGS.
+
2015-04-07 Jakub Jelinek <jakub@redhat.com>
Iain Sandoe <iain@codesourcery.com>
diff --git a/config/mh-darwin b/config/mh-darwin
index a039f20..148b730 100644
--- a/config/mh-darwin
+++ b/config/mh-darwin
@@ -1,18 +1,29 @@
# 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 += \
+# compiles by 3-5%. Don't add it if the compiler doesn't also support
+# -mno-dynamic-no-pic to undo it.
+DARWIN_MDYNAMIC_NO_PIC := \
`case ${host} in i?86-*-darwin* | powerpc-*-darwin*) \
- echo -mdynamic-no-pic ;; esac;`
+ $(CC) -S -xc /dev/null -o /dev/null -mno-dynamic-no-pic 2>/dev/null \
+ && echo -mdynamic-no-pic ;; esac`
+DARWIN_GCC_MDYNAMIC_NO_PIC := \
+`case ${host} in i?86-*-darwin* | powerpc-*-darwin*) \
+ $(CC) -S -xc /dev/null -o /dev/null -mno-dynamic-no-pic 2>/dev/null \
+ || echo -mdynamic-no-pic ;; 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;`
+DARWIN_NO_PIE := `case ${host} in *-*-darwin[1][1-9]*) echo -Wl,-no_pie ;; esac;`
+
+BOOT_CFLAGS += $(DARWIN_MDYNAMIC_NO_PIC)
+BOOT_LDFLAGS += $(DARWIN_NO_PIE)
# 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;`
+STAGE1_CFLAGS += $(DARWIN_MDYNAMIC_NO_PIC)
+STAGE1_LDFLAGS += $(DARWIN_NO_PIE)
+
+# Without -mno-dynamic-no-pic support, add -mdynamic-no-pic just to later
+# stages when we know it is built with gcc.
+STAGE2_CFLAGS += $(DARWIN_GCC_MDYNAMIC_NO_PIC)
+STAGE3_CFLAGS += $(DARWIN_GCC_MDYNAMIC_NO_PIC)
+STAGE4_CFLAGS += $(DARWIN_GCC_MDYNAMIC_NO_PIC)
diff --git a/config/picflag.m4 b/config/picflag.m4
index 836523d..2f5b972 100644
--- a/config/picflag.m4
+++ b/config/picflag.m4
@@ -7,11 +7,15 @@ AC_DEFUN([_GCC_PICFLAG], [
case "${$2}" in
# PIC is the default on some targets or must not be used.
*-*-darwin*)
- # PIC is the default on this platform
- # Common symbols not allowed in MH_DYLIB files
- # Cancel any earlier -mdynamic-no-pic, as that makes
- # the code not suitable for shared libraries.
- $1='-fno-common -mno-dynamic-no-pic'
+ # For darwin, common symbols are not allowed in MH_DYLIB files
+ case "${CFLAGS}" in
+ # If we are using a compiler supporting mdynamic-no-pic
+ # and the option has been tested as safe to add, then cancel
+ # it here, since the code generated is incompatible with shared
+ # libs.
+ *-mdynamic-no-pic*) $1='-fno-common -mno-dynamic-no-pic' ;;
+ *) $1=-fno-common ;;
+ esac
;;
alpha*-dec-osf5*)
# PIC is the default.