]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR target/65351 (libiberty's pic version contains non-pic code on m32 darwin;...
authorJakub Jelinek <jakub@redhat.com>
Fri, 10 Apr 2015 06:43:52 +0000 (08:43 +0200)
committerIain Sandoe <iains@gcc.gnu.org>
Fri, 10 Apr 2015 06:43:52 +0000 (06:43 +0000)
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

config/ChangeLog
config/mh-darwin
config/picflag.m4
gcc/ChangeLog
gcc/configure
libada/ChangeLog
libada/configure
libgcc/ChangeLog
libgcc/configure
libiberty/ChangeLog
libiberty/configure

index 08b9c8d8bf311e0dd492d1e141ec32d1db9aef8d..a2225cdab705e217b12540767b5aa5c788420378 100644 (file)
@@ -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>
 
index a039f201410987b876a2cc259e6f1ca09f8b25bc..148b73038c3e429a671d04b1c62eff79220435a7 100644 (file)
@@ -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)
index 836523d67c965168571b668f4959b5e2242f3694..2f5b9721eb2fa8f6058beb9a15585612df49bb13 100644 (file)
@@ -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.
index 43a341e4e8bec94181471cba156b459b7f4b1017..ac2604220f5ac45f245106e115c616740d2815dd 100644 (file)
@@ -1,3 +1,9 @@
+2015-04-10  Jakub Jelinek  <jakub@redhat.com>
+           Iain Sandoe  <iain@codesourcery.com>
+
+       PR target/65351
+       * configure: Regenerate.
+
 2015-04-09  Kirill Yukhin  <kirill.yukhin@intel.com>
 
        PR target/65671
index ed948285282cc110742941f05bcc34f7823a2342..9523773e721bd8dd162aca96671a29d037bc10c2 100755 (executable)
@@ -4786,11 +4786,15 @@ esac
 case "${target}" 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.
-       PICFLAG_FOR_TARGET='-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*) PICFLAG_FOR_TARGET='-fno-common -mno-dynamic-no-pic' ;;
+         *) PICFLAG_FOR_TARGET=-fno-common ;;
+       esac
        ;;
     alpha*-dec-osf5*)
        # PIC is the default.
@@ -18149,7 +18153,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18152 "configure"
+#line 18156 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -18255,7 +18259,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18258 "configure"
+#line 18262 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
index 5f3a40aa8899c85c37548cb0bd9d445b9682e6cd..5c006de6f43e2e21a2d9c0fa048ad68543711376 100644 (file)
@@ -1,3 +1,9 @@
+2015-04-10  Jakub Jelinek  <jakub@redhat.com>
+           Iain Sandoe  <iain@codesourcery.com>
+
+       PR target/65351
+       * configure: Regenerate.
+
 2015-04-07  Jakub Jelinek  <jakub@redhat.com>
            Iain Sandoe  <iain@codesourcery.com>
 
index 1e169758d0b63da392b5a36634b8ffa9e0c9e187..2296096d4d242fa78ab0e89a626980a0023b63c0 100755 (executable)
@@ -2824,11 +2824,15 @@ fi
 case "${host}" 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.
-       PICFLAG='-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*) PICFLAG='-fno-common -mno-dynamic-no-pic' ;;
+         *) PICFLAG=-fno-common ;;
+       esac
        ;;
     alpha*-dec-osf5*)
        # PIC is the default.
index 6856ff2a3264310e157d1001884484bcd2964669..6fd8b8e0ca681dfe983bc6956b164adb4d483d16 100644 (file)
@@ -1,3 +1,9 @@
+2015-04-10  Jakub Jelinek  <jakub@redhat.com>
+           Iain Sandoe  <iain@codesourcery.com>
+
+       PR target/65351
+       * configure: Regenerate.
+
 2015-04-07  Jakub Jelinek  <jakub@redhat.com>
            Iain Sandoe  <iain@codesourcery.com>
 
index 54e8712b49e81cee6f92c9fb2e42d6d56fd13742..08c931929c7c7ba4c3d80ff3d2c3ff04b9701da7 100644 (file)
@@ -2303,11 +2303,15 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
 case "${host}" 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.
-       PICFLAG='-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*) PICFLAG='-fno-common -mno-dynamic-no-pic' ;;
+         *) PICFLAG=-fno-common ;;
+       esac
        ;;
     alpha*-dec-osf5*)
        # PIC is the default.
index b71f4922962319110c377e5a9e66a3154fc0109b..bdf5a0487c1923a9557bf8bb9fc9e4a77412e5dd 100644 (file)
@@ -1,3 +1,9 @@
+2015-04-10  Jakub Jelinek  <jakub@redhat.com>
+           Iain Sandoe  <iain@codesourcery.com>
+
+       PR target/65351
+       * configure: Regenerate.
+
 2015-04-07  Jakub Jelinek  <jakub@redhat.com>
            Iain Sandoe  <iain@codesourcery.com>
 
index eaed56e3e1bbc02fe52c283e6e64d80f5602efa2..b06cab24efa57a9bc6aff387d47833188b796e53 100755 (executable)
@@ -4885,11 +4885,15 @@ fi
 case "${host}" 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.
-       PICFLAG='-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*) PICFLAG='-fno-common -mno-dynamic-no-pic' ;;
+         *) PICFLAG=-fno-common ;;
+       esac
        ;;
     alpha*-dec-osf5*)
        # PIC is the default.