[PATCH] gdb: restrict configure error with all targets and 64 bit bfd to mips
Guinevere Larsen
guinevere@redhat.com
Wed Feb 12 19:28:17 GMT 2025
On 2/12/25 3:39 PM, Maciej W. Rozycki wrote:
> On Wed, 5 Feb 2025, Maciej W. Rozycki wrote:
>
>>> I spoke to Maciej, and actually what is going on is that mips really needs 64
>>> bit bfd, and requests that in the bfd/configure file.
>>>
>>> Somehow that isn't propagated, and both gdb's and opcodes's configure doesn't
>>> get that propagated correctly. The proper fix would involve propagating things
>>> correctly in several configure files, and I don't even understand why it
>>> fails, so it is a bit over my head...
>> There's something fishy going on here that has to be investigated. It
>> may come from native 32-bit MIPS configurations such as `mips-linux-gnu'
>> requiring 64-bit BFD, uniquely I believe across 32-bit native builds, so
>> if the host and the default targets are `mips-linux-gnu' both at a time,
>> then 64-bit BFD must have somehow been enabled anyway. Weird that it
>> seems as if not.
>>
>> I'm not sure offhand if my native 32-bit MIPS environment is up to the
>> task toolchain-wise, or whether it would be feasible for me time-wise to
>> set up a crossed build of native 32-bit MIPS GDB, as I reckon there are
>> extra host library requirements for GDB, but I'll see if I can reproduce
>> it sometime.
> So I don't have a C++17 compiler in the first place in my native 32-bit
> MIPS environment, but I was able to trigger this issue with a crossed
> native `mips-linux-gnu' `--enable-targets=all' build.
>
> And after a little detective work I can see where the configury logic is
> flawed: configuring for a 32-bit host enables 64-bit BFD implicitly via
> this statement in bfd/configure.ac:
>
> case ${host64}-${target64}-${want64} in
> *true*)
> wordsize=64
> [...]
> ;;
> false-false-false)
> wordsize=32
> all_backends='$(BFD32_BACKENDS)'
> ;;
> esac
>
> (notice how wordsize=64 can be set regardless of the host pointer size),
> but config/bfd64.m4 only checks for `--enable-64-bit-bfd' and the host
> pointer size, which in preset ${want64} and set ${host64} respectively in
> bfd/configure.ac, ignoring any ${want64} overrides or the ${target64}
> part.
>
> Following this observation I also triggered this build failure with a
> `--host=i386-linux-gnu --target=riscv64-linux-gnu --enable-targets=all'
> Canadian cross configuration; it has nothing specific to do with the MIPS
> host and said configuration still breaks at link time with our trunk (it's
> libopcodes rather than GDB that fails anyway).
>
> I think the correct way to get this mess sorted is to move BFD_64_BIT
> code from config/bfd64.m4 over to bfd/configure.ac for its private use
> only and write replacement BFD_64_BIT that just checks for BFD64, having
> included "bfd.h".
>
> Cc'ing binutils as the problem spans across. I have posted a proposed
> fix now; cf.
> <https://inbox.sourceware.org/gdb-patches/a7356a9c-ea48-ff18-d99b-4e2840a871fc@redhat.com/>.
>
> Maciej
>
Thanks for this in-depth evaluation! I took a look over your patch, but
it is a lot more advanced on autotools than what I understand. I'm
testing it on the original machine that caused problems!
--
Cheers,
Guinevere Larsen
She/Her/Hers
More information about the Binutils
mailing list