Skip to contentSkip to conversation

Config.in: add -Og option

PATCH Superseded Martin Kelly 3 participants 8 messages May 16, 2016 – May 18, 2016

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Config.in: add -Og option

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

---
Changes based on feedback:
- select --> depends on
- Reworded help text
- Wrapped text to 72 lines
---

 Config.in           | 10 ++++++++++
 package/Makefile.in |  3 +++
 2 files changed, 13 insertions(+)
Config.in +10 -0
index 9bc8e51..3fe6b7a 100644
@@ -510,6 +510,16 @@ config BR2_OPTIMIZE_3
 	  and also turns on the -finline-functions, -funswitch-loops and
 	  -fgcse-after-reload options.
 
+config BR2_OPTIMIZE_g
+	bool "optimize for debugging"
+	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8
+	help
+	  Optimize for debugging. This 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.
+
 config BR2_OPTIMIZE_S
 	bool "optimize for size"
 	help
package/Makefile.in +3 -0
index 616bdd0..2d6ff89 100644
@@ -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

#1 lore raw

PATCH v2 1/1 Config.in: add -Og option

Quoted 10 lines · Martin Kelly

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

---
Changes based on feedback:
- select --> depends on
- Reworded help text
- Wrapped text to 72 lines

Well, actually you didn't: you just copied my text, which I incorrectly
wrapped at 78 columns instead of 72...

Quoted 11 lines

---

 Config.in           | 10 ++++++++++
 package/Makefile.in |  3 +++
 2 files changed, 13 insertions(+)
Config.in +0 -0
index 9bc8e51..3fe6b7a 100644

Config.in config BR2_OPTIMIZE_3 · line 513

Quoted 4 lines
Config.in +1 -0
@@ -510,6 +510,16 @@ config BR2_OPTIMIZE_3
 	  and also turns on the -finline-functions, -funswitch-loops and
 	  -fgcse-after-reload options.
 
+config BR2_OPTIMIZE_g

I didn't notice this the first time: config options should be all capitals,
like BR2_OPTIMIZE_S (for the -Os option).

Regards,
Arnout

Quoted 34 lines
Config.in +9 -0
+	bool "optimize for debugging"
+	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8
+	help
+	  Optimize for debugging. This 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.
+
 config BR2_OPTIMIZE_S
 	bool "optimize for size"
 	help
package/Makefile.in +3 -1
index 616bdd0..2d6ff89 100644
@@ -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

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#2 lore raw

PATCH v2 1/1 Config.in: add -Og option

Quoted 12 lines · Arnout Vandecappelle
Quoted 10 lines · Martin Kelly

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

---
Changes based on feedback:
- select --> depends on
- Reworded help text
- Wrapped text to 72 lines

Quoted 3 lines

Well, actually you didn't: you just copied my text, which I
incorrectly wrapped at 78 columns instead of 72...

You may have wrapped to 78, but I rewrapped it to 72 columns, so I think the patch I sent is correctly wrapped.

Quoted 14 lines
Quoted 14 lines

---

 Config.in           | 10 ++++++++++
 package/Makefile.in |  3 +++
 2 files changed, 13 insertions(+)
Config.in +0 -0
index 9bc8e51..3fe6b7a 100644
@@ -510,6 +510,16 @@ config BR2_OPTIMIZE_3
       and also turns on the -finline-functions, -funswitch-loops and
       -fgcse-after-reload options.
 
Quoted 5 lines

Config.in config BR2_OPTIMIZE_3 · line 513

Quoted 1 line
Config.in +1 -0
+config BR2_OPTIMIZE_g

I didn't notice this the first time: config options should be all
capitals, like BR2_OPTIMIZE_S (for the -Os option).

I will change this and send a revised patch. Note that there are currently several config options that are not all capital (e.g. BR2_STRIP_strip), but perhaps those should change too.

#3 lore raw

PATCH v2 1/1 Config.in: add -Og option

Hello,

Quoted 3 lines · Martin Kelly

I will change this and send a revised patch. Note that there are currently several config options that are not all capital (e.g. BR2_STRIP_strip), but perhaps those should change too.

There are indeed previous options that were introduced a long long long time ago, when we didn't had such a thorough review process. Unfortunately, changing them is annoying, as it breaks all the existing .config files for users. For this reason, we try to not rename options just for the beauty of it.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#4 lore raw

PATCH v2 1/1 Config.in: add -Og option

In reply to Martin Kelly
Quoted 13 lines · Martin Kelly
Quoted 12 lines · Arnout Vandecappelle
Quoted 10 lines · Martin Kelly

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

---
Changes based on feedback:
- select --> depends on
- Reworded help text
- Wrapped text to 72 lines

Quoted 6 lines
Quoted 3 lines

Well, actually you didn't: you just copied my text, which I
incorrectly wrapped at 78 columns instead of 72...

You may have wrapped to 78, but I rewrapped it to 72 columns, so I think the patch I sent is correctly wrapped.

By my count, the line 'reasonable level of optimization while maintaining fast
compilation' is 68 characters long. with the tab + 2 spaces that becomes 78.

Quoted 21 lines
Quoted 15 lines
Quoted 15 lines

---

 Config.in           | 10 ++++++++++
 package/Makefile.in |  3 +++
 2 files changed, 13 insertions(+)
Config.in +0 -0
index 9bc8e51..3fe6b7a 100644
@@ -510,6 +510,16 @@ config BR2_OPTIMIZE_3
       and also turns on the -finline-functions, -funswitch-loops and
       -fgcse-after-reload options.
 
Quoted 5 lines

Config.in config BR2_OPTIMIZE_3 · line 513

Quoted 1 line
Config.in +1 -0
+config BR2_OPTIMIZE_g

I didn't notice this the first time: config options should be all
capitals, like BR2_OPTIMIZE_S (for the -Os option).

Quoted 3 lines

I will change this and send a revised patch. Note that there are currently several config options that are not all capital (e.g. BR2_STRIP_strip), but perhaps those should change too.

Historical accident. It's not important enough to change it.

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#5 lore raw

PATCH v2 1/1 Config.in: add -Og option

Quoted 19 lines · Arnout Vandecappelle
Quoted 18 lines · Martin Kelly
Quoted 16 lines · Arnout Vandecappelle
Quoted 11 lines · Martin Kelly

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

---
Changes based on feedback:
- select --> depends on
- Reworded help text
- Wrapped text to 72 lines

Well, actually you didn't: you just copied my text, which I
incorrectly wrapped at 78 columns instead of 72...

Quoted 8 lines
Quoted 3 lines

You may have wrapped to 78, but I rewrapped it to 72 columns, so I think the
patch I sent is correctly wrapped.

By my count, the line 'reasonable level of optimization while
maintaining fast compilation' is 68 characters long. with the tab + 2 spaces that becomes 78.

I was working under the assumption that tabs count as 1 character. If tabs count as 8 characters instead, then the rest of the file is already miswrapped; there are many lines containing a tab, 2 spaces, and 70 characters after. Under BR_OPTIMIZE_2, the line starting with "the performance of the generated code" is an example of that. In addition, most text editors seem to count a tab as 1 character when displaying width (Vim certainly does).

If the intention is to count a tab as 8 characters, I'd be happy to do so, but then we should also rewrap the rest of the file for consistency.

Quoted 21 lines
Quoted 21 lines
Quoted 20 lines
Quoted 12 lines

---

 Config.in           | 10 ++++++++++
 package/Makefile.in |  3 +++
 2 files changed, 13 insertions(+)
Config.in +0 -0
index 9bc8e51..3fe6b7a 100644

Config.in config BR2_OPTIMIZE_3 · line 513

Quoted 4 lines
Config.in +1 -0
@@ -510,6 +510,16 @@ config BR2_OPTIMIZE_3
       and also turns on the -finline-functions, -funswitch-loops and
       -fgcse-after-reload options.
 
+config BR2_OPTIMIZE_g

I didn't notice this the first time: config options should be all
capitals, like BR2_OPTIMIZE_S (for the -Os option).

Quoted 8 lines
Quoted 5 lines

I will change this and send a revised patch. Note that there are currently
several config options that are not all capital (e.g. BR2_STRIP_strip), but
perhaps those should change too.

Historical accident. It's not important enough to change it.

Agreed.

#6 lore raw

PATCH v2 1/1 Config.in: add -Og option

Quoted 5 lines · Martin Kelly

I was working under the assumption that tabs count as 1 character. If tabs count as 8 characters instead, then the rest of the file is already miswrapped; there are many lines containing a tab, 2 spaces, and 70 characters after.

Correction: "there are many lines containing a tab, 2 spaces, and 68 characters after".

#7 lore raw

PATCH v2 1/1 Config.in: add -Og option

In reply to Martin Kelly
Quoted 36 lines · Martin Kelly
Quoted 19 lines · Arnout Vandecappelle
Quoted 18 lines · Martin Kelly
Quoted 16 lines · Arnout Vandecappelle
Quoted 11 lines · Martin Kelly

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

---
Changes based on feedback:
- select --> depends on
- Reworded help text
- Wrapped text to 72 lines

Well, actually you didn't: you just copied my text, which I
incorrectly wrapped at 78 columns instead of 72...

Quoted 8 lines
Quoted 3 lines

You may have wrapped to 78, but I rewrapped it to 72 columns, so I think the
patch I sent is correctly wrapped.

By my count, the line 'reasonable level of optimization while
maintaining fast compilation' is 68 characters long. with the tab + 2 spaces that becomes 78.

I was working under the assumption that tabs count as 1 character. If tabs count as 8 characters instead, then the rest of the file is already miswrapped; there are many lines containing a tab, 2 spaces, and 70 characters after. Under BR_OPTIMIZE_2, the line starting with "the performance of the generated code" is an example of that. In addition, most text editors seem to count a tab as 1 character when displaying width (Vim certainly does).

Quoted 2 lines

If the intention is to count a tab as 8 characters, I'd be happy to do so, but then we should also rewrap the rest of the file for consistency.

You have a point there. I'll Ack your v3, care to send a follow-up that
rewraps the entire file?

Regards,
Arnout

[snip]

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF