From cacf1f59069873d69005fd274184adc25da3bc90 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 10 Apr 2015 08:43:52 +0200 Subject: [PATCH] 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 From-SVN: r221967 --- config/ChangeLog | 9 +++++++++ config/mh-darwin | 31 +++++++++++++++++++++---------- config/picflag.m4 | 14 +++++++++----- gcc/ChangeLog | 6 ++++++ gcc/configure | 18 +++++++++++------- libada/ChangeLog | 6 ++++++ libada/configure | 14 +++++++++----- libgcc/ChangeLog | 6 ++++++ libgcc/configure | 14 +++++++++----- libiberty/ChangeLog | 6 ++++++ libiberty/configure | 14 +++++++++----- 11 files changed, 101 insertions(+), 37 deletions(-) diff --git a/config/ChangeLog b/config/ChangeLog index 08b9c8d8bf31..a2225cdab705 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 a039f2014109..148b73038c3e 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 836523d67c96..2f5b9721eb2f 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 43a341e4e8be..ac2604220f5a 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 ed948285282c..9523773e721b 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 5f3a40aa8899..5c006de6f43e 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 1e169758d0b6..2296096d4d24 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 6856ff2a3264..6fd8b8e0ca68 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 54e8712b49e8..08c931929c7c 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 b71f49229623..bdf5a0487c19 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 eaed56e3e1bb..b06cab24efa5 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. -- 2.39.2