From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp2.wavenetuk.net (unknown [195.26.37.10]) by sourceware.org (Postfix) with ESMTP id 56CB8385802A; Wed, 2 Dec 2020 16:11:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 56CB8385802A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=sandoe.co.uk Authentication-Results: sourceware.org; spf=none smtp.mailfrom=iain@sandoe.co.uk Received: from [192.168.1.212] (host81-138-1-83.in-addr.btopenworld.com [81.138.1.83]) by smtp2.wavenetuk.net (Postfix) with ESMTPA id 573A66000F6; Wed, 2 Dec 2020 16:11:58 +0000 (GMT) Content-Type: text/plain; charset=utf-8; delsp=yes; format=flowed Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: [PATCH 1, 2] Darwin : Update libtool and dependencies for Darwin20 [PR97865] From: Iain Sandoe In-Reply-To: <20201124104735.GB1312820@redhat.com> Date: Wed, 2 Dec 2020 16:11:24 +0000 Cc: Jeff Law Content-Transfer-Encoding: 8bit Message-Id: <8739298D-11AD-473A-A881-56A9DAAC9561@sandoe.co.uk> References: <20201124104735.GB1312820@redhat.com> To: GCC Patches , libstdc++ X-Mailer: Apple Mail (2.3273) X-Spam-Status: No, score=-15.5 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_COUK, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, KHOP_HELO_FCRDNS, MAY_BE_FORGED, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2020 16:12:03 -0000 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 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.