unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Vineet Gupta <vineetg@rivosinc.com>
To: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>,
	Palmer Dabbelt <palmer@rivosinc.com>
Cc: libc-alpha@sourceware.org, carlos@redhat.com, maskray@google.com,
	ludo@gnu.org, nelson@rivosinc.com, gnu-toolchain@rivosinc.com
Subject: Re: [PATCH] Revert "Correctly determine libc.so 'OUTPUT_FORMAT' when cross-compiling."
Date: Wed, 30 Nov 2022 16:45:42 -0800	[thread overview]
Message-ID: <fbbdbf8a-e198-db78-3361-1b2a26419ba2@rivosinc.com> (raw)
In-Reply-To: <d72f5f6f-cc3a-bd89-0800-ffb068928e0f@linaro.org>


On 11/30/22 04:39, Adhemerval Zanella Netto wrote:
>
> On 28/11/22 20:25, Palmer Dabbelt wrote:
>> On Tue, 22 Nov 2022 18:59:32 PST (-0800), Vineet Gupta wrote:
>>> This reverts commit 361d6454c034a920f2c96517c277990d390b9652.
>>>
>>> This trips up riscv gnu toolchain builds [1]
>>>
>>> riscv ld segfaults when linking libgcc because libc.so linker script
>>> contains `OUTPUT_FORMAT(elf32-little)` vs. `OUTPUT_FORMAT(elf32-littleriscv)`.
>> Sounds like a linker bug?
>>
>>> This patch causes builds to lookup riscv32* prefixed objdump and failing
>>> to find it falls back to host objdump which is the root of the issue.
>>> The host objdump in turn generates `OUTPUT_FORMAT(elf32-little)`
>>>
>>> riscv glibc multilib builds lack riscv32 prefix binaries. They have a
>>> single set of "riscv64" prefixed binaries supporting both 32 and 64-bit
>>> abis: ilp32/ilp32d/lp64/lp64d using -march/-mabi.
>> Though we _could_ have riscv32-* and riscv64-* binaries (and also riscv*- too), it just doesn't make much of a difference as the riscv64-* binaries can target everything.  If the answer here is just "fix riscv-gnu-toolchain" that seems reasonable to me, but also happy to avoid touching that so
>>
>> Acked-by: Palmer Dabbelt <palmer@rivosinc.com>
>>
>> Though some sort of global reviewer should take a look here, I definately don't understand the glibc build process well enough to review this one.
>>
>
> I think the question is whether we need to set OBJDUMP and/or can override
> or if we should derive the tools solely from CC.  It make sense for later,
> since using a different binutils than the one CC is meant to use not always
> guarantee that compiler will emits all supports instructions or ABI.

Certainly the ability to override OBJDUMP (actually all of binutils) 
seems useful. However the issue with the original patch was it assuming 
that triplet prefixed binary exists and even worse it silently falling 
back to host binary if it fails to find one. If we really want to 
support the original patch, it should add a fallback of using $CC 
-print-prog-name if the triplet binary search fails.

But as it stands, riscv multilib toolchain builds are currently hosed 
because of this.

-Vineet

> The build-many-glibc.py sets the OBJDUMP, so I think it would be good to
> also remove its usage (since with this patch OBJDUMP can not be override
> anymore).  In fact the only way to override the binutils with
> LIBC_PROG_BINUTILS is to use --with-binutils (which has some issues [1]
> though).
>
> The --with-binutils is also a developer options, so I wonder if we should
> simplify the build process by removing it along with LIBC_PROG_BINUTILS, and
> replace with a new macro that checks whether the tools is set, otherwise uses
> the CC with -print-prog-name for default case.
>
> It would continue to provide a way to override binutils tools (for development
> and testing) and simplify the build process (one less configure option).  GUIX
> can then override OBJDUMP if it need (and it was not clear not me why
> CC -print-prog-name does not work on this environment).
>
> [1] https://patchwork.sourceware.org/project/glibc/patch/20221115193159.173838-2-adhemerval.zanella@linaro.org/


      reply	other threads:[~2022-12-01  0:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-23  2:59 [PATCH] Revert "Correctly determine libc.so 'OUTPUT_FORMAT' when cross-compiling." Vineet Gupta
2022-11-26 14:57 ` Ludovic Courtès via Libc-alpha
2022-11-28  2:24   ` Vineet Gupta
2022-11-28 15:37     ` Ludovic Courtès via Libc-alpha
2022-11-28 19:04       ` Vineet Gupta
2022-11-28 23:25 ` Palmer Dabbelt
2022-11-30 12:39   ` Adhemerval Zanella Netto via Libc-alpha
2022-12-01  0:45     ` Vineet Gupta [this message]

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

  List information: https://www.gnu.org/software/libc/involved.html

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

  git send-email \
    --in-reply-to=fbbdbf8a-e198-db78-3361-1b2a26419ba2@rivosinc.com \
    --to=vineetg@rivosinc.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=carlos@redhat.com \
    --cc=gnu-toolchain@rivosinc.com \
    --cc=libc-alpha@sourceware.org \
    --cc=ludo@gnu.org \
    --cc=maskray@google.com \
    --cc=nelson@rivosinc.com \
    --cc=palmer@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).