Bug 24600 - Support --start-lib --end-lib
Summary: Support --start-lib --end-lib
Status: UNCONFIRMED
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-05-22 14:31 UTC by Fangrui Song
Modified: 2024-07-10 23:37 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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