From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 87C97384A87E for ; Tue, 24 Nov 2020 10:47:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 87C97384A87E Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-247-AwwjM7DaM1OSDAWmphw5Jw-1; Tue, 24 Nov 2020 05:47:38 -0500 X-MC-Unique: AwwjM7DaM1OSDAWmphw5Jw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1C65D873093; Tue, 24 Nov 2020 10:47:37 +0000 (UTC) Received: from localhost (unknown [10.33.37.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id 994F160C13; Tue, 24 Nov 2020 10:47:36 +0000 (UTC) Date: Tue, 24 Nov 2020 10:47:35 +0000 From: Jonathan Wakely To: Iain Sandoe Cc: GCC Patches , libstdc++ , Jeff Law Subject: Re: [PATCH 1,2] Darwin : Update libtool and dependencies for Darwin20 [PR97865] Message-ID: <20201124104735.GB1312820@redhat.com> References: MIME-Version: 1.0 In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-14.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, 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: Tue, 24 Nov 2020 10:47:42 -0000 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.