[PATCH 1, 2] Darwin : Update libtool and dependencies for Darwin20 [PR97865]

Iain Sandoe iain@sandoe.co.uk
Wed Dec 2 16:11:24 GMT 2020


given that this is a blocker for Darwin20 and is Darwin-local I plan to
apply it (with the spello fixes) if there are no more comments in the next
24h.

thanks
Iain

Jonathan Wakely <jwakely@redhat.com> wrote:

> On 23/11/20 20:01 +0000, Iain Sandoe wrote:
>> Hi
>>
>> This fixes a blocker for x86_64 darwin20 (a.k.a macOS 11)
>> It is needed on all open branches too.
>>
>> (probably this comes under my Dariwn hat - but since it involves
>> regenerating all the configure scripts… I’d welcome another pair
>> of eyes)
>>
>> tested on:
>> darwin8-darwin20, powerpc, i686, x86_64, arm64(aarch64).
>> aix (cfarm gcc119), aarch64 (cfarm gcc115), powerpc64 (BE) - (cfarm  
>> gcc110)
>> powerpc64 (LE) - (cfarm gcc135), sparc solaris 2.11 (gcc211)
>> x86_64-linux-gnu (cfarm gcc123)
>>
>> OK for master?
>>
>> OK for backports?
>>
>> thanks
>> iain
>>
>> N.B. I am attaching the second patch which is the uninteresting  
>> regenerated files.
>>
>> =====
>>
>> The change in major version (and the increment from Darwin19 to 20)
>> caused libtool tests to fail which resulted in incorrect build settings
>> for shared libraries.
>>
>> We take this opportunity to sort out the shared undefined symbols state
>> rather than propagating the current unsound behaviour into a new rev.
>>
>> This change means that we default to the case that missing symbols are
>> considered an error, and if one wants to allow this intentionally, the
>> confiuration for that case should be set appropriately.
>>
>> We use intentional missing symbols to emulate the ELF behaviour when
>> we have a weak undefined extern.
>>
>> So, three existing cases need undefined dynamic lookup:
>> libitm, where there is already a configuration mechanism to add the
>>        flags.
>> libsanitizer, likewise
>> libcc1, where we add simple configuration to add the flags for Darwin.
>>
>> libcc1/ChangeLog:
>>
>> 	PR target/97865
>> 	* Makefile.am: Add dynamic_lookup to LD flags for Darwin.
>> 	* configure.ac: Test for Darwin host and set a flag.
>>
>> libitm/ChangeLog:
>>
>> 	PR target/97865
>> 	* configure.tgt: Add dynamic_lookup to XLDFLAGS for Darwin.
>>
>> libsanitizer/ChangeLog:
>>
>> 	PR target/97865
>> 	* configure.tgt: Add dynamic_lookup to EXTRA_CXXFLAGS for
>> 	Darwin.
>>
>> ChangeLog:
>>
>> 	PR target/97865
>> 	* libtool.m4: Update handling of Darwin platform link flags
>> 	for Darwin20.
>>
>>
>> ---
>> libcc1/Makefile.am         |  3 +++
>> libcc1/configure.ac        |  6 ++++++
>> libitm/configure.tgt       |  9 ++++++++-
>> libsanitizer/configure.tgt |  1 +
>> libtool.m4                 | 32 +++++++++++++++++---------------
>> 5 files changed, 35 insertions(+), 16 deletions(-)
>>
>> diff --git a/libcc1/Makefile.am b/libcc1/Makefile.am
>> index ab6f839ecae..173b84f9cdb 100644
>> --- a/libcc1/Makefile.am
>> +++ b/libcc1/Makefile.am
>> @@ -25,6 +25,9 @@ CPPFLAGS_FOR_C_FAMILY = -I $(srcdir)/../gcc/c-family \
>> CPPFLAGS_FOR_C = $(CPPFLAGS_FOR_C_FAMILY) -I $(srcdir)/../gcc/c
>> CPPFLAGS_FOR_CXX = $(CPPFLAGS_FOR_C_FAMILY) -I $(srcdir)/../gcc/cp
>> AM_CXXFLAGS = $(WARN_FLAGS) $(WERROR) $(visibility) $(CET_HOST_FLAGS)
>> +if DARWIN_DYNAMIC_LOOKUP
>> +AM_CXXFLAGS += -Wl,-undefined,dynamic_lookup
>> +endif
>> override CXXFLAGS := $(filter-out -fsanitize=address,$(CXXFLAGS))
>> override LDFLAGS := $(filter-out -fsanitize=address,$(LDFLAGS))
>> # Can be simplified when libiberty becomes a normal convenience library.
>> diff --git a/libcc1/configure.ac b/libcc1/configure.ac
>> index 8d3b8d14748..262e0a61e6f 100644
>> --- a/libcc1/configure.ac
>> +++ b/libcc1/configure.ac
>> @@ -104,6 +104,12 @@ AC_CACHE_CHECK([for socket libraries],  
>> libcc1_cv_lib_sockets,
>> ])
>> LIBS="$LIBS $libcc1_cv_lib_sockets"
>>
>> +case "$host" in
>> +  *-*-darwin*) darwin_dynamic_lookup=yes ;;
>> +  *) darwin_dynamic_lookup= ;;
>> +esac
>> +AM_CONDITIONAL(DARWIN_DYNAMIC_LOOKUP, test $darwin_dynamic_lookup = yes)
>> +
>> # If any of these functions are missing, simply don't bother building
>> # this plugin.
>> GCC_ENABLE_PLUGINS
>> diff --git a/libitm/configure.tgt b/libitm/configure.tgt
>> index 04109160e91..d1beb5c9ec8 100644
>> --- a/libitm/configure.tgt
>> +++ b/libitm/configure.tgt
>> @@ -43,6 +43,7 @@ if test "$gcc_cv_have_tls" = yes ; then
>>    *-*-linux*)
>> 	XCFLAGS="${XCFLAGS} -ftls-model=initial-exec"
>> 	;;
>> +
>>  esac
>> fi
>>
>> @@ -144,10 +145,16 @@ case "${target}" in
>>  *-*-gnu* | *-*-k*bsd*-gnu \
>>  | *-*-netbsd* | *-*-freebsd* | *-*-openbsd* \
>>  | *-*-solaris2* | *-*-sysv4* | *-*-hpux11* \
>> -  | *-*-darwin* | *-*-aix* | *-*-dragonfly*)
>> +  | *-*-aix* | *-*-dragonfly*)
>> 	# POSIX system.  The OS is supported.
>> 	;;
>>
>> +  *-*-darwin*)
>> +	# The OS is supported, but we need dynamic lookup to support undefined
>> +	# weak symbols at link-time.
>> +	XLDFLAGS="${XLDFLAGS} -Wl,-undefined,dynamic_lookup"
>> +	;;
>> +
>>  *)	# Non-POSIX, or embedded system
>> 	UNSUPPORTED=1
>> 	;;
>> diff --git a/libsanitizer/configure.tgt b/libsanitizer/configure.tgt
>> index ef9150209c4..f73d410dedf 100644
>> --- a/libsanitizer/configure.tgt
>> +++ b/libsanitizer/configure.tgt
>> @@ -64,6 +64,7 @@ case "${target}" in
>> 	;;
>>  x86_64-*-darwin2* | x86_64-*-darwin1[2-9]* | i?86-*-darwin1[2-9]*)
>> 	TSAN_SUPPORTED=no
>> +	EXTRA_CXXFLAGS+="-Wl,-undefined,dynamic_lookup"
>> 	;;
>>  x86_64-*-solaris2.11* | i?86-*-solaris2.11*)
>> 	;;
>> diff --git a/libtool.m4 b/libtool.m4
>> index e194e899fcf..9b14b9470df 100644
>> --- a/libtool.m4
>> +++ b/libtool.m4
>> @@ -994,23 +994,25 @@ _LT_EOF
>>        rm -f conftest.err libconftest.a conftest conftest.c
>>        rm -rf conftest.dSYM
>>    ])
>> -    case $host_os in
>> -    rhapsody* | darwin1.[[012]])
>> +    # Allow for Darwin 4-7 (macOS 10.0-10.3) although these are not  
>> expect to
>> +    # build without first building modern cctools / linker.
>> +    case $host_cpu-$host_os in
>> +    *-rhapsody* | *-darwin1.[[012]])
>>      _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
>> -    darwin1.*)
>> +    *-darwin1.*)
>>      _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
>> -    darwin*) # darwin 5.x on
>> -      # if running on 10.5 or later, the deployment target defaults
>> -      # to the OS version, if on x86, and 10.4, the deployment
>> -      # target defaults to 10.4. Don't you love it?
>> -      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
>> -	10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
>> -	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
>> +    *-darwin*)
>> +      # darwin 5.x (macoS 10.5) onwards we only adjust when the  
>> deployement
>
> Typos "macoS" and "deployement".
>
> Apart from that, I have no comment on it because darwin versioning
> twists my melon.
>
> The regenerated configure for libstdc++ is OK.




More information about the Gcc-patches mailing list