[Buildroot] [git commit] Config.in: change default optimization level from -Os to -O2
Yann E. MORIN
yann.morin.1998 at free.fr
Sun Jan 7 16:59:48 UTC 2024
commit: https://git.buildroot.net/buildroot/commit/?id=292949c638e304ad5104004b95de7895ef3bd405
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master
Historically, Buildroot has defaulted to -Os as the gcc optimization
flags. However, this default is probably not the most appropriate
anymore, and this commit therefore changes the default to -O2.
Here are some arguments in favor of this change:
- Most Buildroot users use Buildroot for platforms that have a
reasonable amount of storage, and the difference between -Os and -O2
in terms of code size is no longer as significant compared to the
size of storage available on average embedded Linux devices
typically found these days.
- -Os can have a pretty bad performance impact, compared to -O2.
- -Os is much less widely tested than -O2. For example, with recent
versions of gcc, there are parts of Qt5 that segfault when compiled
with -Os and work perfectly fine with -O2. Yes, it's a compiler bug
that should be fixed, but in the mean time, having a default that's
more widely used/tested makes sense.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni at bootlin.com>
Acked-by: Yann E. MORIN <yann.morin.1998 at free.fr>
Signed-off-by: Yann E. MORIN <yann.morin.1998 at free.fr>
---
Config.in | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Config.in b/Config.in
index 7b6ea801e7..113adf0755 100644
--- a/Config.in
+++ b/Config.in
@@ -474,7 +474,7 @@ config BR2_STRIP_EXCLUDE_DIRS
choice
prompt "gcc optimization level"
- default BR2_OPTIMIZE_S
+ default BR2_OPTIMIZE_2
help
Set the optimization level for gcc
@@ -520,6 +520,7 @@ config BR2_OPTIMIZE_2
-falign-loops -falign-labels -ftree-vrp -ftree-pre. Please
note the warning under -fgcse about invoking -O2 on programs
that use computed gotos.
+ This is the default.
config BR2_OPTIMIZE_3
bool "optimization level 3"
@@ -548,7 +549,6 @@ config BR2_OPTIMIZE_S
-falign-loops -falign-labels -freorder-blocks
-freorder-blocks-and-partition -fprefetch-loop-arrays
-ftree-vect-loop-version
- This is the default.
config BR2_OPTIMIZE_FAST
bool "optimize for fast (may break packages!)"
More information about the buildroot
mailing list