Bug 24600

Summary: Support --start-lib --end-lib
Product: binutils Reporter: Fangrui Song <i>
Component: ldAssignee: Not yet assigned to anyone <unassigned>
Status: UNCONFIRMED ---    
Severity: normal CC: amodra
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:

Description Fangrui Song 2019-05-22 14:31:49 UTC
--start-lib gives following object files (before --end-lib) archive semantics.
They are handy if you don't want to create archives for the semantics.
Some build system makes use of this option as an optimization: after changes of object files, no archives need updating.

% ld.lld a.o --start-lib b.o --end-lib
% gold a.o --start-lib b.o --end-lib
% ld.bfd a.o --start-lib b.o --end-lib
ld.bfd: unrecognized option '--start-lib'
ld.bfd: use the --help option for usage information

--start-lib can not be nested in --start-group, vice versa.
Comment 1 Fangrui Song 2020-04-05 20:47:18 UTC
This option can sometimes be more useful than a thin archive.
Comment 2 Fangrui Song 2022-01-17 01:18:39 UTC
If this is implemented, an archive without an index can be parsed as a group of --start-lib object files.

I have a write-up https://maskray.me/blog/2022-01-16-archives-and-start-lib