RFC: Should the linker support '--fast' and if so, what should it do ?
Fangrui Song
i@maskray.me
Thu Mar 19 03:31:54 GMT 2026
On Wed, Mar 18, 2026 at 4:39 AM Nick Clifton <nickc@redhat.com> wrote:
>
> Hi Guys,
>
> OK, this one is probably going to be controversial...
>
> I was wondering whether it would be useful to have a linker command
> line option to request a fast link, even if the results are not as
> good as a normal link. In particular it occurred to me the merging
> string sections (and other mergeable sections) is not actually
> required by the ELF standard. So if we skip that step quite a lot of
> time can be saved. In my tests for example I saw time savings of
> around 20% for big links. Of course the resulting executables are
> unnecessarily large and probably a bit slower than their merged
> equivalents, but for test builds during a development process this
> might not be an issue.
>
> So - am I going mad here or is this something worth looking into ?
>
> Cheers
> Nick
>
We can reuse -O for this purpose...
In ld.lld, -O1 is the default.
-O0 disables constant merge of SHF_MERGE.
-O2 enables some computation heavy size optimization:
enable string suffix merge of SHF_MERGE|SHF_STRINGS. This is very slow
and not parallel.
--compress-debug-sections=zlib uses zlib compression with higher
compression ratio.
More information about the Binutils
mailing list