Message ID | 20220725152229.3370033-1-arnout@mind.be |
---|---|
State | Accepted |
Headers | show |
Series | [1/5] Config.in: add new option BR2_ENABLE_LTO to globally enable LTO | expand |
On Mon, 25 Jul 2022 17:22:25 +0200 "Arnout Vandecappelle (Essensium/Mind)" <arnout@mind.be> wrote: > 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> > --- > Config.in | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) Series applied, thanks! Thomas
diff --git a/Config.in b/Config.in index af9052d32b..8fc431a5da 100644 --- a/Config.in +++ b/Config.in @@ -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
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> --- Config.in | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)