Config.in: add new option BR2_ENABLE_LTO to globally enable LTO

Some packages have a configure option to enable LTO. Add a global option
to enable/disable this in packages.

Note that we could instead (or in addition) pass -flto directly to the
compiler in the toolchain wrapper, but that has a *much* bigger impact,
so for the time being let's not do that.

No toolchain dependency is added for this, because all toolchains now
support LTO.
- LTO support was merged in GCC years before 4.6 (our minimal version)
  was released.
- Our oldest external toolchain, Sourcery ARM 2014.05, has LTO support.
- For our internal toolchains, it is supposedly regulated by
  BR2_GCC_ENABLE_LTO. However, that option only *enables* it - it
  doesn't disable LTO support when it's not provided. Since LTO support
  defaults to enabled for a long time already in GCC, in practice all
  Buildroot-generated toolchains do support LTO.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2022.08.x
Arnout Vandecappelle (Essensium/Mind) 2022-07-25 17:22:25 +02:00 committed by Thomas Petazzoni
parent 4c47efafc2
commit fb51422780
1 changed files with 19 additions and 0 deletions

View File

@ -551,6 +551,25 @@ config BR2_OPTIMIZE_FAST
endchoice
config BR2_ENABLE_LTO
bool "build packages with link-time optimisation"
help
Enable the link-time optimisation (LTO) option when building
packages. Link-time optimisation re-runs optimisations at
link time, which allows the compiler to do interprocedural
analysis across compilation units and thus come with better
results: smaller size and better performance.
Note that this analysis is limited to statically linked
object files and libraries.
This option may significantly increase build times,
sometimes 5 times longer, with only limited gains.
At this time, this option only enables LTO in packages that
have an explicit configuration option for it. Other packages
always enable LTO, but most packages never enable LTO.
config BR2_GOOGLE_BREAKPAD_ENABLE
bool "Enable google-breakpad support"
depends on BR2_INSTALL_LIBSTDCPP