[PATCH v2 00/16] PR ld/24600: Add general linker support for mapless archives

Maciej W. Rozycki macro@orcam.me.uk
Thu Nov 6 21:18:51 GMT 2025


Hi,

 This is v2 of a patch series originally posted here 
<https://inbox.sourceware.org/binutils/alpine.DEB.2.21.2509251408330.15999@angie.orcam.me.uk/>.  
It now includes `--start-lib'/`--end-lib' linker command line option 
support, however I chose to keep the original subject for the cover letter 
for the purpose of mailbox sorting.

 As some changes have been already committed and new issues found in the 
course of implementing the second part, patch positions have now changed,
so the respective previous versions are referred from individual updated 
changes.

 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.

 Here's an overview of the updated set:

 1. Add a set of XFAILs referring PR binutils/33485 for NS32k targets.

 2. Update the testsuite for the Alpha/VMS target, recently fixed.

 3. Fix a sign-extension bug for Alpha/VMS.

 4. Add test cases for the `--whole-archive' feature.

 5. Add test cases for the archive group feature.

 6. Make the file position consistently unsigned in symbol maps.

 7. Add a BFD pointer member to `struct carsym' (symbol map).

 8. Fix a crash on an attempt to free an uninitialized section hash.

 9. Unset the format on releasing a BFD's objalloc memory.

10. Expand support for mapless archives across all the BFD linkers (beyond 
    just XCOFF).

11. Add `--link-mapless'/`--no-link-mapless' LD options to control the new 
    feature, on by default (and now switchable off for XCOFF too, but not 
    effective for Alpha/VMS whose archive format does not support omitting 
    an index).

12. Guard NULL pointer use with assertions in LD where adding a new input
    file.

13. Factor out input file insertion in LD.

14. Add a BFD pointer member to structures referring to archive members.

15. Add fake archive support to BFD as a list of member BFDs supplied.

16. Add `--start-lib'/`--end-lib' LD options and a corresponding linker 
    script feature building upon the fake archive BFD feature.

See individual change descriptions for details.

 This has been verified across 249 targets, causing no regressions and 
adding no failures in new tests.  The `cris*-*-*' target failure from v1 
has now gone, owing to commit c1a7d039587b ("cris: bfd: Default selected 
target to the configured target"), however I have not investigated a fix 
for the underlying problem yet (where the default BFD target is always 
used for mapless archives, which may cause issues with some non-default 
linker emulations).

 OK to apply?

  Maciej


More information about the Binutils mailing list