RFC: Should the linker support '--fast' and if so, what should it do ?
Jan Beulich
jbeulich@suse.com
Wed Mar 25 13:59:54 GMT 2026
On 25.03.2026 14:31, Nick Clifton wrote:
> Attached is a proposed patch to implement "-O 0" as a command line option
> that disables merging.
>
> The patch does change the linker's default behaviour, albeit in a small way:
> It changes the linker's nominal default optimization level to 1 instead of 0,
> so that in order to gain the enable-heavy-optimization effect you need to link
> with "0O 2" (or higher) whereas before "-O 1" would have also done this. (With
> the patch applied "-O 1" now restores the linker's default behaviour of neither
> optimizing nor skipping the merge stage).
>
> Thoughts ?
I'm not entirely happy with forcing people to change the -O uses they may have.
But perhaps that's tolerable. A possible alternative might be to support -O- to
have the effect of setting optimize_level to 0, while -O <number> would set it
to <number>+1. Yet of course -O0 has widely known meaning ...
I'm also uncertain as to the two "high cost" optimizations that you now move to
-O2. Are they really high cost?
The doc change may want to be a little less ELF-centric. Inserting "e.g." may
already suffice to address that.
--help output could do with also stating the default.
Perhaps not for this patch, but the handling of -O could also do with some
improvement. "-O --help", for example, better wouldn't do what it does now.
Jan
More information about the Binutils
mailing list