Hi! I've committed the following patch (which Iain tested - at least libiberty part). The issue is that while Darwin is PIC by default, for performance reasons it uses -mdynamic-no-pic and that makes code compiled that way not suitable for shared libraries.
Committed to trunk as obvious. 2015-04-07 Jakub Jelinek <ja...@redhat.com> Iain Sandoe <i...@codesourcery.com> PR target/65351 config/ * picflag.m4: Append -mno-dynamic-no-pic for Darwin. libiberty/ * configure: Regenerate. libada/ * configure: Regenerate. libgcc/ * configure: Regenerate. gcc/ * configure: Regenerate. --- config/picflag.m4.jj 2013-11-18 09:59:08.000000000 +0100 +++ config/picflag.m4 2015-04-07 11:40:49.963566972 +0200 @@ -9,7 +9,9 @@ case "${$2}" in *-*-darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - $1=-fno-common + # Cancel any earlier -mdynamic-no-pic, as that makes + # the code not suitable for shared libraries. + $1='-fno-common -mno-dynamic-no-pic' ;; alpha*-dec-osf5*) # PIC is the default. --- libiberty/configure.jj 2014-11-24 10:26:27.000000000 +0100 +++ libiberty/configure 2015-04-07 11:41:43.075707899 +0200 @@ -4887,7 +4887,9 @@ case "${host}" in *-*-darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - PICFLAG=-fno-common + # Cancel any earlier -mdynamic-no-pic, as that makes + # the code not suitable for shared libraries. + PICFLAG='-fno-common -mno-dynamic-no-pic' ;; alpha*-dec-osf5*) # PIC is the default. --- libada/configure.jj 2015-01-05 13:40:49.000000000 +0100 +++ libada/configure 2015-04-07 11:42:44.517715744 +0200 @@ -2826,7 +2826,9 @@ case "${host}" in *-*-darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - PICFLAG=-fno-common + # Cancel any earlier -mdynamic-no-pic, as that makes + # the code not suitable for shared libraries. + PICFLAG='-fno-common -mno-dynamic-no-pic' ;; alpha*-dec-osf5*) # PIC is the default. --- libgcc/configure.jj 2015-03-09 08:05:17.000000000 +0100 +++ libgcc/configure 2015-04-07 11:42:30.927935072 +0200 @@ -2305,7 +2305,9 @@ case "${host}" in *-*-darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - PICFLAG=-fno-common + # Cancel any earlier -mdynamic-no-pic, as that makes + # the code not suitable for shared libraries. + PICFLAG='-fno-common -mno-dynamic-no-pic' ;; alpha*-dec-osf5*) # PIC is the default. --- gcc/configure.jj 2015-03-11 20:17:47.000000000 +0100 +++ gcc/configure 2015-04-07 11:42:11.266252397 +0200 @@ -4788,7 +4788,9 @@ case "${target}" in *-*-darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - PICFLAG_FOR_TARGET=-fno-common + # 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' ;; alpha*-dec-osf5*) # PIC is the default. @@ -18147,7 +18149,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 18150 "configure" +#line 18152 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -18253,7 +18255,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 18256 "configure" +#line 18258 "configure" #include "confdefs.h" #if HAVE_DLFCN_H Jakub