Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/5] Config.in: add new option BR2_ENABLE_LTO to globally enable LTO
@ 2022-07-25 15:22 Arnout Vandecappelle (Essensium/Mind)
  2022-07-25 15:22 ` [Buildroot] [PATCH 2/5] package/*: use BR2_ENABLE_LTO to enable LTO instead of BR2_GCC_ENABLE_LTO Arnout Vandecappelle (Essensium/Mind)
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Arnout Vandecappelle (Essensium/Mind) @ 2022-07-25 15:22 UTC (permalink / raw)
  To: buildroot; +Cc: Peter Kümmel, Douglas RAILLARD, Dario Binacchi

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(+)

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
-- 
2.35.3

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-07-26 19:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-25 15:22 [Buildroot] [PATCH 1/5] Config.in: add new option BR2_ENABLE_LTO to globally enable LTO Arnout Vandecappelle (Essensium/Mind)
2022-07-25 15:22 ` [Buildroot] [PATCH 2/5] package/*: use BR2_ENABLE_LTO to enable LTO instead of BR2_GCC_ENABLE_LTO Arnout Vandecappelle (Essensium/Mind)
2022-07-25 15:22 ` [Buildroot] [PATCH 3/5] configs/*: " Arnout Vandecappelle (Essensium/Mind)
2022-07-25 15:22 ` [Buildroot] [PATCH 4/5] package/binutils: remove BR2_BINUTILS_ENABLE_LTO Arnout Vandecappelle (Essensium/Mind)
2022-07-25 15:22 ` [Buildroot] [PATCH 5/5] package/gcc: remove BR2_GCC_ENABLE_LTO Arnout Vandecappelle (Essensium/Mind)
2022-07-26 19:57 ` [Buildroot] [PATCH 1/5] Config.in: add new option BR2_ENABLE_LTO to globally enable LTO Thomas Petazzoni via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox