[Buildroot] [PATCH] Config.in: add -Og option

Martin Kelly martin at surround.io
Fri May 13 23:57:06 UTC 2016


-Og (introduced in GCC 4.8) lets you optimize for debugging experience,
which can be useful for when you want optimized code that is nonetheless
debuggable.

Signed-off-by: Martin Kelly <martin at surround.io>
---
 Config.in           | 11 +++++++++++
 package/Makefile.in |  3 +++
 2 files changed, 14 insertions(+)

diff --git a/Config.in b/Config.in
index b5cc892..9330de1 100644
--- a/Config.in
+++ b/Config.in
@@ -510,6 +510,17 @@ config BR2_OPTIMIZE_3
 	  and also turns on the -finline-functions, -funswitch-loops and
 	  -fgcse-after-reload options.
 
+config BR2_OPTIMIZE_g
+	bool "optimize debugging experience"
+	select BR2_HOST_GCC_AT_LEAST_4_8
+	help
+	  Optimize debugging experience. -Og enables optimizations that do not
+	  interfere with debugging. It should be the optimization level of choice for
+	  the standard edit-compile-debug cycle, offering a reasonable level of
+	  optimization while maintaining fast compilation and a good debugging
+	  experience. If you use multiple -O options, with or without level numbers,
+	  the last such option is the one that is effective.
+
 config BR2_OPTIMIZE_S
 	bool "optimize for size"
 	help
diff --git a/package/Makefile.in b/package/Makefile.in
index 616bdd0..2d6ff89 100644
--- a/package/Makefile.in
+++ b/package/Makefile.in
@@ -122,6 +122,9 @@ endif
 ifeq ($(BR2_OPTIMIZE_3),y)
 TARGET_OPTIMIZATION = -O3
 endif
+ifeq ($(BR2_OPTIMIZE_g),y)
+TARGET_OPTIMIZATION = -Og
+endif
 ifeq ($(BR2_OPTIMIZE_S),y)
 TARGET_OPTIMIZATION = -Os
 endif
-- 
2.1.4




More information about the buildroot mailing list