[PATCH 7/8] PR ld/24600: BFD: Add general linker support for mapless archives
Hans-Peter Nilsson
hp@axis.com
Sat Sep 27 02:51:00 GMT 2025
> Date: Sat, 27 Sep 2025 00:53:45 +0100
> From: "Maciej W. Rozycki" <macro@orcam.me.uk>
> Expand linker mapless archive support from XCOFF targets only across the
> remaining ones. For this tranform BFD code used by AR to produce symbol
> maps to archive files such as to have a handler supplied to either write
> a map to a file or convert symbol data to an archive symbol definition
> table attached to an archive BFD as if read from a symbol map, but using
> pointers to member BFDs rather than file offsets. Retain XCOFF handling
> code as it is.
>
> Update documentation and adjust test cases accordingly now that mapless
> archives are accepted for link by all targets.
>
> This, notably, has triggered test failures:
>
> cris-elf +FAIL: Regular archive w/o index link
> cris-elf +FAIL: Thin archive w/o index link
> crisv32-linux +FAIL: Regular archive w/o index link
> crisv32-linux +FAIL: Thin archive w/o index link
>
> all caused by a segfault in `aout_get_external_symbols' trying to access
> `aout_data' data of an ELF BFD.
>
> This comes from a combination of factors. Firstly, ELF and Linux CRIS
> targets set the default BFD target to a.out and at the same time they
> set the default linker emulation to ELF. Secondly, for mapless archives
> code in `bfd_check_format_matches' ignores the BFD target supplied by
> the linker and resorts to iterating over all the BFD formats to find one
> to match. Thirdly, when called in the linker `bfd_generic_archive_p'
> accepts any archive file without any verification of its member files.
> Consequently the default a.out BFD target is chosen for ELF input.
>
> This only affects the new feature and is not a regression, so shouldn't
> stop this change and will best be sorted independently.
I can read the above as you're suggesting this patch,
despite it causing a regression in test results for cris-elf
and crisv32-linux, and still say it is "not a regression"?
I hope I misunderstood. Perhaps those are new tests ("git
grep" doesn't hit). Then please xfail them for cris*-elf
and cris*-linux. I don't think we use kfail, that seems
more gdb?
I'm open to other changes that don't cause testsuite
regressions, like to the effect of not defaulting to a.out.
I don't remember that one, but it sounds wrong.
brgds, H-P
More information about the Binutils
mailing list