From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by sourceware.org (Postfix) with ESMTPS id 3948F3858C60; Fri, 21 Jan 2022 16:54:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3948F3858C60 Received: by mail-wr1-x42b.google.com with SMTP id f17so781000wrx.1; Fri, 21 Jan 2022 08:54:43 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=luLTRvQ4Bvzf+FuHj6S1MZrFLywTmcULC4GTtY8lO1w=; b=6sBfubB1ijKrWlDx7b6ej7gBwqkW8JZ204FSK0rrCHG+Y49zlnHtPrTTdwVyD8ruPR KQkXYcEsXw5KeWFSoVsjc8lHD2SUQUX5vonEGBmSbM7b1kEZRxRPpfusyPi1ezo2tWyF iCciIQnb6EgDXqRqpq/mpjQYV7Xdf8mtSLNMLpPgS3sPgiAaqij5xC0StwFY958wm6jQ WCi1F88JvbluaMs9m+HgJBjd0hD1IvNtgKuSZCJyeoR2EyhPLG8YplfyOxSZ1tR64vpO 5KMPh6P3Jku1P/4YKXONC+lOt297xSGm1oNQfXwAxJW8B9QkRHDEk33VbKXlMHtTIG67 yuAA== X-Gm-Message-State: AOAM531LXDEBaa1YpWn86h177XEdHcddWLc5xXh5u30iOoMvz4/5Qpdx Bmk4I4t/6Xvzl6PkwqKyfyXy5t890/j25HTa11c= X-Google-Smtp-Source: ABdhPJxbgHVuT6pKfZ4/l/Ths1Ij/y3u4z1YEraCscH6QWIxTk/pzsQEtur1OjjoFzzVB6VHrFTT3yacRDGjMtYXFIo= X-Received: by 2002:a5d:6e8b:: with SMTP id k11mr4616391wrz.102.1642784081941; Fri, 21 Jan 2022 08:54:41 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Jonathan Wakely Date: Fri, 21 Jan 2022 16:54:29 +0000 Message-ID: Subject: Re: [PATCH] libstdc++: detect mold linker. To: =?UTF-8?Q?Martin_Li=C5=A1ka?= Cc: gcc-patches , "libstdc++" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Jan 2022 16:54:45 -0000 On Fri, 21 Jan 2022 at 16:11, Martin Li=C5=A1ka wrote: > > Hi. > > This adds linker detection for mold in libstdc++-v3. > > Ready to be installed? Yes, OK (but please CC the libstdc++ list, not just me). > Thanks, > Martin > > libstdc++-v3/ChangeLog: > > * acinclude.m4: Detect features for ld.mold linker. > * configure: Regenerate. > --- > libstdc++-v3/acinclude.m4 | 8 +++++- > libstdc++-v3/configure | 52 +++++++++++++++++++++++++++++++-------- > 2 files changed, 49 insertions(+), 11 deletions(-) > > diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 > index d996477254c..1a7d7a96050 100644 > --- a/libstdc++-v3/acinclude.m4 > +++ b/libstdc++-v3/acinclude.m4 > @@ -172,6 +172,7 @@ dnl LD (as a side effect of testing) > dnl Sets: > dnl with_gnu_ld > dnl glibcxx_ld_is_gold (set to "no" or "yes") > +dnl glibcxx_ld_is_mold (set to "no" or "yes") > dnl glibcxx_gnu_ld_version (possibly) > dnl > dnl The last will be a single integer, e.g., version 1.23.45.0.67.89 wi= ll > @@ -204,11 +205,14 @@ AC_DEFUN([GLIBCXX_CHECK_LINKER_FEATURES], [ > # Start by getting the version number. I think the libtool test alre= ady > # does some of this, but throws away the result. > glibcxx_ld_is_gold=3Dno > + glibcxx_ld_is_mold=3Dno > if test x"$with_gnu_ld" =3D x"yes"; then > AC_MSG_CHECKING([for ld version]) > changequote(,) > if $LD --version 2>/dev/null | grep 'GNU gold' >/dev/null 2>&1; the= n > glibcxx_ld_is_gold=3Dyes > + elif $LD --version 2>/dev/null | grep 'mold' >/dev/null 2>&1; then > + glibcxx_ld_is_mold=3Dyes > fi > ldver=3D`$LD --version 2>/dev/null | > sed -e 's/[. ][0-9]\{8\}$//;s/.* \([^ ]\{1,\}\)$/\1/; q'` > @@ -220,7 +224,7 @@ AC_DEFUN([GLIBCXX_CHECK_LINKER_FEATURES], [ > > # Set --gc-sections. > glibcxx_have_gc_sections=3Dno > - if test "$glibcxx_ld_is_gold" =3D "yes"; then > + if test "$glibcxx_ld_is_gold" =3D "yes" || test "$glibcxx_ld_is_mold" = =3D "yes" ; then > if $LD --help 2>/dev/null | grep gc-sections >/dev/null 2>&1; then > glibcxx_have_gc_sections=3Dyes > fi > @@ -3796,6 +3800,8 @@ changequote([,])dnl > enable_symvers=3Dno > elif test $glibcxx_ld_is_gold =3D yes ; then > : All versions of gold support symbol versioning. > + elif test $glibcxx_ld_is_mold =3D yes ; then > + : All versions of mold support symbol versioning. > elif test $glibcxx_gnu_ld_version -lt $glibcxx_min_gnu_ld_version ; t= hen > # The right tools, the right setup, but too old. Fallbacks? > AC_MSG_WARN(=3D=3D=3D Linker version $glibcxx_gnu_ld_version is too= old for) > diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure > index 4c20c669144..0b551b864ce 100755 > --- a/libstdc++-v3/configure > +++ b/libstdc++-v3/configure > @@ -22157,12 +22157,15 @@ with_gnu_ld=3D$lt_cv_prog_gnu_ld > # Start by getting the version number. I think the libtool test alre= ady > # does some of this, but throws away the result. > glibcxx_ld_is_gold=3Dno > + glibcxx_ld_is_mold=3Dno > if test x"$with_gnu_ld" =3D x"yes"; then > { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld version" >= &5 > $as_echo_n "checking for ld version... " >&6; } > > if $LD --version 2>/dev/null | grep 'GNU gold' >/dev/null 2>&1; the= n > glibcxx_ld_is_gold=3Dyes > + elif $LD --version 2>/dev/null | grep 'mold' >/dev/null 2>&1; then > + glibcxx_ld_is_mold=3Dyes > fi > ldver=3D`$LD --version 2>/dev/null | > sed -e 's/[. ][0-9]\{8\}$//;s/.* \([^ ]\{1,\}\)$/\1/; q'` > @@ -22175,7 +22178,7 @@ $as_echo "$glibcxx_gnu_ld_version" >&6; } > > # Set --gc-sections. > glibcxx_have_gc_sections=3Dno > - if test "$glibcxx_ld_is_gold" =3D "yes"; then > + if test "$glibcxx_ld_is_gold" =3D "yes" || test "$glibcxx_ld_is_mold" = =3D "yes" ; then > if $LD --help 2>/dev/null | grep gc-sections >/dev/null 2>&1; then > glibcxx_have_gc_sections=3Dyes > fi > @@ -29371,12 +29374,15 @@ ac_compiler_gnu=3D$ac_cv_c_compiler_gnu > # Start by getting the version number. I think the libtool test alre= ady > # does some of this, but throws away the result. > glibcxx_ld_is_gold=3Dno > + glibcxx_ld_is_mold=3Dno > if test x"$with_gnu_ld" =3D x"yes"; then > { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld version" >= &5 > $as_echo_n "checking for ld version... " >&6; } > > if $LD --version 2>/dev/null | grep 'GNU gold' >/dev/null 2>&1; the= n > glibcxx_ld_is_gold=3Dyes > + elif $LD --version 2>/dev/null | grep 'mold' >/dev/null 2>&1; then > + glibcxx_ld_is_mold=3Dyes > fi > ldver=3D`$LD --version 2>/dev/null | > sed -e 's/[. ][0-9]\{8\}$//;s/.* \([^ ]\{1,\}\)$/\1/; q'` > @@ -29389,7 +29395,7 @@ $as_echo "$glibcxx_gnu_ld_version" >&6; } > > # Set --gc-sections. > glibcxx_have_gc_sections=3Dno > - if test "$glibcxx_ld_is_gold" =3D "yes"; then > + if test "$glibcxx_ld_is_gold" =3D "yes" || test "$glibcxx_ld_is_mold" = =3D "yes" ; then > if $LD --help 2>/dev/null | grep gc-sections >/dev/null 2>&1; then > glibcxx_have_gc_sections=3Dyes > fi > @@ -35303,12 +35309,15 @@ done > # Start by getting the version number. I think the libtool test alre= ady > # does some of this, but throws away the result. > glibcxx_ld_is_gold=3Dno > + glibcxx_ld_is_mold=3Dno > if test x"$with_gnu_ld" =3D x"yes"; then > { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld version" >= &5 > $as_echo_n "checking for ld version... " >&6; } > > if $LD --version 2>/dev/null | grep 'GNU gold' >/dev/null 2>&1; the= n > glibcxx_ld_is_gold=3Dyes > + elif $LD --version 2>/dev/null | grep 'mold' >/dev/null 2>&1; then > + glibcxx_ld_is_mold=3Dyes > fi > ldver=3D`$LD --version 2>/dev/null | > sed -e 's/[. ][0-9]\{8\}$//;s/.* \([^ ]\{1,\}\)$/\1/; q'` > @@ -35321,7 +35330,7 @@ $as_echo "$glibcxx_gnu_ld_version" >&6; } > > # Set --gc-sections. > glibcxx_have_gc_sections=3Dno > - if test "$glibcxx_ld_is_gold" =3D "yes"; then > + if test "$glibcxx_ld_is_gold" =3D "yes" || test "$glibcxx_ld_is_mold" = =3D "yes" ; then > if $LD --help 2>/dev/null | grep gc-sections >/dev/null 2>&1; then > glibcxx_have_gc_sections=3Dyes > fi > @@ -47234,12 +47243,15 @@ done > # Start by getting the version number. I think the libtool test alre= ady > # does some of this, but throws away the result. > glibcxx_ld_is_gold=3Dno > + glibcxx_ld_is_mold=3Dno > if test x"$with_gnu_ld" =3D x"yes"; then > { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld version" >= &5 > $as_echo_n "checking for ld version... " >&6; } > > if $LD --version 2>/dev/null | grep 'GNU gold' >/dev/null 2>&1; the= n > glibcxx_ld_is_gold=3Dyes > + elif $LD --version 2>/dev/null | grep 'mold' >/dev/null 2>&1; then > + glibcxx_ld_is_mold=3Dyes > fi > ldver=3D`$LD --version 2>/dev/null | > sed -e 's/[. ][0-9]\{8\}$//;s/.* \([^ ]\{1,\}\)$/\1/; q'` > @@ -47252,7 +47264,7 @@ $as_echo "$glibcxx_gnu_ld_version" >&6; } > > # Set --gc-sections. > glibcxx_have_gc_sections=3Dno > - if test "$glibcxx_ld_is_gold" =3D "yes"; then > + if test "$glibcxx_ld_is_gold" =3D "yes" || test "$glibcxx_ld_is_mold" = =3D "yes" ; then > if $LD --help 2>/dev/null | grep gc-sections >/dev/null 2>&1; then > glibcxx_have_gc_sections=3Dyes > fi > @@ -47519,12 +47531,15 @@ done > # Start by getting the version number. I think the libtool test alre= ady > # does some of this, but throws away the result. > glibcxx_ld_is_gold=3Dno > + glibcxx_ld_is_mold=3Dno > if test x"$with_gnu_ld" =3D x"yes"; then > { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld version" >= &5 > $as_echo_n "checking for ld version... " >&6; } > > if $LD --version 2>/dev/null | grep 'GNU gold' >/dev/null 2>&1; the= n > glibcxx_ld_is_gold=3Dyes > + elif $LD --version 2>/dev/null | grep 'mold' >/dev/null 2>&1; then > + glibcxx_ld_is_mold=3Dyes > fi > ldver=3D`$LD --version 2>/dev/null | > sed -e 's/[. ][0-9]\{8\}$//;s/.* \([^ ]\{1,\}\)$/\1/; q'` > @@ -47537,7 +47552,7 @@ $as_echo "$glibcxx_gnu_ld_version" >&6; } > > # Set --gc-sections. > glibcxx_have_gc_sections=3Dno > - if test "$glibcxx_ld_is_gold" =3D "yes"; then > + if test "$glibcxx_ld_is_gold" =3D "yes" || test "$glibcxx_ld_is_mold" = =3D "yes" ; then > if $LD --help 2>/dev/null | grep gc-sections >/dev/null 2>&1; then > glibcxx_have_gc_sections=3Dyes > fi > @@ -47995,12 +48010,15 @@ ac_compiler_gnu=3D$ac_cv_c_compiler_gnu > # Start by getting the version number. I think the libtool test alre= ady > # does some of this, but throws away the result. > glibcxx_ld_is_gold=3Dno > + glibcxx_ld_is_mold=3Dno > if test x"$with_gnu_ld" =3D x"yes"; then > { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld version" >= &5 > $as_echo_n "checking for ld version... " >&6; } > > if $LD --version 2>/dev/null | grep 'GNU gold' >/dev/null 2>&1; the= n > glibcxx_ld_is_gold=3Dyes > + elif $LD --version 2>/dev/null | grep 'mold' >/dev/null 2>&1; then > + glibcxx_ld_is_mold=3Dyes > fi > ldver=3D`$LD --version 2>/dev/null | > sed -e 's/[. ][0-9]\{8\}$//;s/.* \([^ ]\{1,\}\)$/\1/; q'` > @@ -48013,7 +48031,7 @@ $as_echo "$glibcxx_gnu_ld_version" >&6; } > > # Set --gc-sections. > glibcxx_have_gc_sections=3Dno > - if test "$glibcxx_ld_is_gold" =3D "yes"; then > + if test "$glibcxx_ld_is_gold" =3D "yes" || test "$glibcxx_ld_is_mold" = =3D "yes" ; then > if $LD --help 2>/dev/null | grep gc-sections >/dev/null 2>&1; then > glibcxx_have_gc_sections=3Dyes > fi > @@ -54383,12 +54401,15 @@ _ACEOF > # Start by getting the version number. I think the libtool test alre= ady > # does some of this, but throws away the result. > glibcxx_ld_is_gold=3Dno > + glibcxx_ld_is_mold=3Dno > if test x"$with_gnu_ld" =3D x"yes"; then > { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld version" >= &5 > $as_echo_n "checking for ld version... " >&6; } > > if $LD --version 2>/dev/null | grep 'GNU gold' >/dev/null 2>&1; the= n > glibcxx_ld_is_gold=3Dyes > + elif $LD --version 2>/dev/null | grep 'mold' >/dev/null 2>&1; then > + glibcxx_ld_is_mold=3Dyes > fi > ldver=3D`$LD --version 2>/dev/null | > sed -e 's/[. ][0-9]\{8\}$//;s/.* \([^ ]\{1,\}\)$/\1/; q'` > @@ -54401,7 +54422,7 @@ $as_echo "$glibcxx_gnu_ld_version" >&6; } > > # Set --gc-sections. > glibcxx_have_gc_sections=3Dno > - if test "$glibcxx_ld_is_gold" =3D "yes"; then > + if test "$glibcxx_ld_is_gold" =3D "yes" || test "$glibcxx_ld_is_mold" = =3D "yes" ; then > if $LD --help 2>/dev/null | grep gc-sections >/dev/null 2>&1; then > glibcxx_have_gc_sections=3Dyes > fi > @@ -60531,12 +60552,15 @@ $as_echo "#define HAVE_TLS 1" >>confdefs.h > # Start by getting the version number. I think the libtool test alre= ady > # does some of this, but throws away the result. > glibcxx_ld_is_gold=3Dno > + glibcxx_ld_is_mold=3Dno > if test x"$with_gnu_ld" =3D x"yes"; then > { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld version" >= &5 > $as_echo_n "checking for ld version... " >&6; } > > if $LD --version 2>/dev/null | grep 'GNU gold' >/dev/null 2>&1; the= n > glibcxx_ld_is_gold=3Dyes > + elif $LD --version 2>/dev/null | grep 'mold' >/dev/null 2>&1; then > + glibcxx_ld_is_mold=3Dyes > fi > ldver=3D`$LD --version 2>/dev/null | > sed -e 's/[. ][0-9]\{8\}$//;s/.* \([^ ]\{1,\}\)$/\1/; q'` > @@ -60549,7 +60573,7 @@ $as_echo "$glibcxx_gnu_ld_version" >&6; } > > # Set --gc-sections. > glibcxx_have_gc_sections=3Dno > - if test "$glibcxx_ld_is_gold" =3D "yes"; then > + if test "$glibcxx_ld_is_gold" =3D "yes" || test "$glibcxx_ld_is_mold" = =3D "yes" ; then > if $LD --help 2>/dev/null | grep gc-sections >/dev/null 2>&1; then > glibcxx_have_gc_sections=3Dyes > fi > @@ -60741,12 +60765,15 @@ done > # Start by getting the version number. I think the libtool test alre= ady > # does some of this, but throws away the result. > glibcxx_ld_is_gold=3Dno > + glibcxx_ld_is_mold=3Dno > if test x"$with_gnu_ld" =3D x"yes"; then > { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld version" >= &5 > $as_echo_n "checking for ld version... " >&6; } > > if $LD --version 2>/dev/null | grep 'GNU gold' >/dev/null 2>&1; the= n > glibcxx_ld_is_gold=3Dyes > + elif $LD --version 2>/dev/null | grep 'mold' >/dev/null 2>&1; then > + glibcxx_ld_is_mold=3Dyes > fi > ldver=3D`$LD --version 2>/dev/null | > sed -e 's/[. ][0-9]\{8\}$//;s/.* \([^ ]\{1,\}\)$/\1/; q'` > @@ -60759,7 +60786,7 @@ $as_echo "$glibcxx_gnu_ld_version" >&6; } > > # Set --gc-sections. > glibcxx_have_gc_sections=3Dno > - if test "$glibcxx_ld_is_gold" =3D "yes"; then > + if test "$glibcxx_ld_is_gold" =3D "yes" || test "$glibcxx_ld_is_mold" = =3D "yes" ; then > if $LD --help 2>/dev/null | grep gc-sections >/dev/null 2>&1; then > glibcxx_have_gc_sections=3Dyes > fi > @@ -60970,12 +60997,15 @@ ac_compiler_gnu=3D$ac_cv_c_compiler_gnu > # Start by getting the version number. I think the libtool test alre= ady > # does some of this, but throws away the result. > glibcxx_ld_is_gold=3Dno > + glibcxx_ld_is_mold=3Dno > if test x"$with_gnu_ld" =3D x"yes"; then > { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld version" >= &5 > $as_echo_n "checking for ld version... " >&6; } > > if $LD --version 2>/dev/null | grep 'GNU gold' >/dev/null 2>&1; the= n > glibcxx_ld_is_gold=3Dyes > + elif $LD --version 2>/dev/null | grep 'mold' >/dev/null 2>&1; then > + glibcxx_ld_is_mold=3Dyes > fi > ldver=3D`$LD --version 2>/dev/null | > sed -e 's/[. ][0-9]\{8\}$//;s/.* \([^ ]\{1,\}\)$/\1/; q'` > @@ -60988,7 +61018,7 @@ $as_echo "$glibcxx_gnu_ld_version" >&6; } > > # Set --gc-sections. > glibcxx_have_gc_sections=3Dno > - if test "$glibcxx_ld_is_gold" =3D "yes"; then > + if test "$glibcxx_ld_is_gold" =3D "yes" || test "$glibcxx_ld_is_mold" = =3D "yes" ; then > if $LD --help 2>/dev/null | grep gc-sections >/dev/null 2>&1; then > glibcxx_have_gc_sections=3Dyes > fi > @@ -74929,6 +74959,8 @@ $as_echo "$as_me: WARNING: =3D=3D=3D Symbol versi= oning will be disabled." >&2;} > enable_symvers=3Dno > elif test $glibcxx_ld_is_gold =3D yes ; then > : All versions of gold support symbol versioning. > + elif test $glibcxx_ld_is_mold =3D yes ; then > + : All versions of mold support symbol versioning. > elif test $glibcxx_gnu_ld_version -lt $glibcxx_min_gnu_ld_version ; t= hen > # The right tools, the right setup, but too old. Fallbacks? > { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: =3D=3D=3D Linker = version $glibcxx_gnu_ld_version is too old for" >&5 > -- > 2.34.1 >