RFC: Should the linker support '--fast' and if so, what should it do ?

Arsen Arsenović aarsenovic@baylibre.com
Thu Mar 19 08:50:04 GMT 2026


Jan Beulich <jbeulich@suse.com> writes:

> On 18.03.2026 12:38, Nick Clifton 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 ?
>
> Well, if there's a use for this (and you name one), then why not if you
> can afford the time to implement this. Nobody has to use the new option.
> Whether, as Fangrui suggests, to utilize -O I'm less certain. That
> might affect people who may prefer to remain unaffected.

The documentation for that flag says:

  ‘-O LEVEL’
       If LEVEL is a numeric values greater than zero ‘ld’ optimizes the
       output.  This might take significantly longer and therefore
       probably should only be enabled for the final binary.  At the
       moment this option only affects ELF shared library generation.
       Future releases of the linker may make more use of this option.
       Also currently there is no difference in the linker's behaviour for
       different non-zero values of this option.  Again this may change
       with future releases.

... so I doubt anyone is using -O0.  Making -O0 be faster while keeping
the default -O1 or such is probably fine.
-- 
Arsen Arsenović
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 430 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20260319/2b0207a4/attachment.sig>


More information about the Binutils mailing list