public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Carlos O'Donell <carlos@redhat.com>
To: "Adhemerval Zanella" <adhemerval.zanella@linaro.org>,
	libc-alpha@sourceware.org, "Vineet Gupta" <vineetg@rivosinc.com>,
	"Ludovic Courtès" <ludo@gnu.org>
Subject: Re: [PATCH v2 1/3] configure: Allow user override LD, AR, OBJCOPY, and GPROF
Date: Wed, 11 Jan 2023 15:25:31 -0500	[thread overview]
Message-ID: <2097ff19-d38a-af35-1d22-7cb2acbf2bb6@redhat.com> (raw)
In-Reply-To: <20221206160243.455627-2-adhemerval.zanella@linaro.org>

On 12/6/22 11:02, Adhemerval Zanella wrote:
> The only way to override LD, AR, OBJCOPY, and GPROF is through
> --with-binutils (setting the environments variables on configure is
> overridden by LIBC_PROG_BINUTILS).
> 
> The build-many-glibcs.py (bmg) glibcs option generates a working config,
> but not fully concise (some tools will be set from environment variable,
> while other will be set from $CC --print-prog-name).  So remove the
> environment variable set to always use the "$CC --print-prog-name".

Reviewed-by: Carlos O'Donell <carlos@redhat.com>

> ---
>  aclocal.m4                   | 16 ++++++++++++----
>  configure                    | 16 ++++++++++++----
>  scripts/build-many-glibcs.py |  3 ---
>  3 files changed, 24 insertions(+), 11 deletions(-)
> 
> diff --git a/aclocal.m4 b/aclocal.m4
> index 7ab8ac023b..cbe3c4698a 100644
> --- a/aclocal.m4
> +++ b/aclocal.m4
> @@ -118,12 +118,20 @@ case "$CC" in
>      *fuse-ld=lld*) LDNAME=ld.lld;;
>      *)             LDNAME=ld;;
>  esac
> -LD=`$CC -print-prog-name=$LDNAME`
> -AR=`$CC -print-prog-name=ar`
> +if test -z "$LD"; then
> +    LD=`$CC -print-prog-name=$LDNAME`
> +fi

OK. Override from env first, then use $CC second.

> +if test -z "$AR"; then
> +    AR=`$CC -print-prog-name=ar`
> +fi

OK. Likewise.

>  AC_SUBST(AR)
> -OBJCOPY=`$CC -print-prog-name=objcopy`
> +if test -z "$OBJCOPY"; then
> +    OBJCOPY=`$CC -print-prog-name=objcopy`
> +fi

OK. Likewise.

>  AC_SUBST(OBJCOPY)
> -GPROF=`$CC -print-prog-name=gprof`
> +if test -z "$GPROF"; then
> +    GPROF=`$CC -print-prog-name=gprof`

OK. Likewise.

> +fi
>  AC_SUBST(GPROF)
>  ])
>  
> diff --git a/configure b/configure
> index 62c2581cb0..8f91bb6e11 100755
> --- a/configure
> +++ b/configure
> @@ -4145,12 +4145,20 @@ case "$CC" in
>      *fuse-ld=lld*) LDNAME=ld.lld;;
>      *)             LDNAME=ld;;
>  esac
> -LD=`$CC -print-prog-name=$LDNAME`
> -AR=`$CC -print-prog-name=ar`
> +if test -z "$LD"; then
> +    LD=`$CC -print-prog-name=$LDNAME`
> +fi
> +if test -z "$AR"; then
> +    AR=`$CC -print-prog-name=ar`
> +fi
>  
> -OBJCOPY=`$CC -print-prog-name=objcopy`
> +if test -z "$OBJCOPY"; then
> +    OBJCOPY=`$CC -print-prog-name=objcopy`
> +fi
>  
> -GPROF=`$CC -print-prog-name=gprof`
> +if test -z "$GPROF"; then
> +    GPROF=`$CC -print-prog-name=gprof`
> +fi
>  
>  
>  
> diff --git a/scripts/build-many-glibcs.py b/scripts/build-many-glibcs.py
> index 9292a0d3ff..887ef7b6d5 100755
> --- a/scripts/build-many-glibcs.py
> +++ b/scripts/build-many-glibcs.py
> @@ -1521,10 +1521,7 @@ class GlibcPolicyDefault(object):
>              '--host=%s' % glibc.triplet,
>              'CC=%s' % glibc.tool_name('gcc'),
>              'CXX=%s' % glibc.tool_name('g++'),
> -            'AR=%s' % glibc.tool_name('ar'),
> -            'LD=%s' % glibc.tool_name('ld'),
>              'NM=%s' % glibc.tool_name('nm'),
> -            'OBJCOPY=%s' % glibc.tool_name('objcopy'),

OK. Cleanup bmg usage to use $CC provided tools.

>              'OBJDUMP=%s' % glibc.tool_name('objdump'),
>              'RANLIB=%s' % glibc.tool_name('ranlib'),
>              'READELF=%s' % glibc.tool_name('readelf'),

-- 
Cheers,
Carlos.


  reply	other threads:[~2023-01-11 20:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-06 16:02 [PATCH v2 0/3] Refactor binutils configure usage Adhemerval Zanella
2022-12-06 16:02 ` [PATCH v2 1/3] configure: Allow user override LD, AR, OBJCOPY, and GPROF Adhemerval Zanella
2023-01-11 20:25   ` Carlos O'Donell [this message]
2022-12-06 16:02 ` [PATCH v2 2/3] configure: Move nm, objdump, and readelf to LIBC_PROG_BINUTILS Adhemerval Zanella
2022-12-06 18:48   ` Adhemerval Zanella Netto
2023-01-11 20:30   ` Carlos O'Donell
2022-12-06 16:02 ` [PATCH v2 3/3] scripts/build-many-glibcs.py: Remove unused RANLIB and STRIP option Adhemerval Zanella
2023-01-11 20:28   ` Carlos O'Donell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2097ff19-d38a-af35-1d22-7cb2acbf2bb6@redhat.com \
    --to=carlos@redhat.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=libc-alpha@sourceware.org \
    --cc=ludo@gnu.org \
    --cc=vineetg@rivosinc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).