diff --git a/config/ChangeLog b/config/ChangeLog index 08b9c8d8bf3..a2225cdab70 100644 --- a/config/ChangeLog +++ b/config/ChangeLog @@ -1,3 +1,12 @@ +2015-04-10 Jakub Jelinek + Iain Sandoe + + 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 Iain Sandoe diff --git a/config/mh-darwin b/config/mh-darwin index a039f201410..148b73038c3 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 836523d67c9..2f5b9721eb2 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. diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 43a341e4e8b..ac2604220f5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-04-10 Jakub Jelinek + Iain Sandoe + + PR target/65351 + * configure: Regenerate. + 2015-04-09 Kirill Yukhin PR target/65671 diff --git a/gcc/configure b/gcc/configure index ed948285282..9523773e721 100755 --- a/gcc/configure +++ b/gcc/configure @@ -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 diff --git a/libada/ChangeLog b/libada/ChangeLog index 5f3a40aa889..5c006de6f43 100644 --- a/libada/ChangeLog +++ b/libada/ChangeLog @@ -1,3 +1,9 @@ +2015-04-10 Jakub Jelinek + Iain Sandoe + + PR target/65351 + * configure: Regenerate. + 2015-04-07 Jakub Jelinek Iain Sandoe diff --git a/libada/configure b/libada/configure index 1e169758d0b..2296096d4d2 100755 --- a/libada/configure +++ b/libada/configure @@ -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. diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 6856ff2a326..6fd8b8e0ca6 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,9 @@ +2015-04-10 Jakub Jelinek + Iain Sandoe + + PR target/65351 + * configure: Regenerate. + 2015-04-07 Jakub Jelinek Iain Sandoe diff --git a/libgcc/configure b/libgcc/configure index 54e8712b49e..08c931929c7 100644 --- a/libgcc/configure +++ b/libgcc/configure @@ -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. diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index b71f4922962..bdf5a0487c1 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,9 @@ +2015-04-10 Jakub Jelinek + Iain Sandoe + + PR target/65351 + * configure: Regenerate. + 2015-04-07 Jakub Jelinek Iain Sandoe diff --git a/libiberty/configure b/libiberty/configure index eaed56e3e1b..b06cab24efa 100755 --- a/libiberty/configure +++ b/libiberty/configure @@ -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.