[PATCH 0/8] PR ld/24600: Add general linker support for mapless archives
Fangrui Song
maskray@sourceware.org
Sat Sep 27 21:14:23 GMT 2025
On Fri, Sep 26, 2025 at 4:53 PM Maciej W. Rozycki <macro@orcam.me.uk> wrote:
>
> Hi,
>
> This is the first stage in adding support for `--start-lib'/`--end-lib'
> linker command line options, expanding linker support for archives with no
> symbol map present across all the targets and archive formats.
>
> As this effort revealed numerous issues in archive handling both for
> already supported scenarios with a symbol map involved and for the new
> scenarios with no symbol map present, as well as a missing cleanup, I've
> split this into a patch set. Here's an overview of the set:
>
> 1. Add new LD testcases for a bunch of archive scenarios, covering PR
> binutils/33484 and PR binutils/33485 in particular.
>
> 2. Add new LD testcases covering the rejection of archives with no symbol
> map present (except for XCOFF targets, which already accept such
> archives).
>
> 3. Remove `struct orl' embedded union's member that has never been used.
>
> 4. Add same member to `struct carsym'.
>
> 5. Fix a crash on an attempt to free an uninitialized section hash.
>
> 6. Unset the format on releasing a BFD's objalloc memory.
>
> 7. Expand support for mapless archives across all the BFD linkers (beyond
> just XCOFF).
>
> 8. Add `--link-mapless'/`--no-link-mapless' LD options to control the new
> feature, on by default (and now switchable off for XCOFF too).
>
> See individual change descriptions for details.
>
> This has been verified across 242 targets, causing no regressions and
> adding no failures in new tests except for `cris*-*-*' targets, discussed
> in detail in 7/8.
>
> OK to apply?
>
> Maciej
Hi Maciej,
Thanks a lot for working on this feature!! I've verified that the
built ld-new supports archives created with `ar rcS`.
b4 am 'alpine.DEB.2.21.2509251408330.15999@angie.orcam.me.uk'
git am 20250927_macro_pr_ld_24600_add_general_linker_support_for_mapless_archives.mbx
Regarding the option name, what do you think of
--[no-]allow-unindexed-archives instead of --link-mapless?
--link-mapless might be confusing since it looks similar to the "link
map" (-M, --Map), even though the functionality (related to archive
index or archive symbol table) is completely different.
I believe --allow-unindexed-archives will primarily be needed during
the transition period as the ecosystem adopts symbol-table-less
archives.
Linkers that already ignore archive symbol tables—like lld, mold, and
likely wild—won't need this option.
More information about the Binutils
mailing list