Skip to contentSkip to conversation

Prune global compilation flags

PATCH Applied Khem Raj 3 participants 11 messages Mar 21, 2011 – Mar 30, 2011

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

cover Prune global compilation flags

This patch series is for removing the unneeded flags in SELECTED_OPTIMIZATIONS that gets passed to every recipe build by default. I have also introduced flags to remove duplicate debug information which will reduce the debug info sections

Tested by building and booting console-image/angstrom on ppc,arm,mips,x86-64,x86 qemu machines.

Please apply

Pull URL: git://git.openembedded.org/openembedded-core-contrib
Branch: kraj/global-opts
Browse: http://git.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=kraj/global-opts

Thanks,
Khem Raj <[email protected]>
---

Khem Raj (3):
bitbake.conf: Prune global OPTIMIZATION flags machine/include/tune-atom.inc: Remove FULL_OPTIMIZATION_pn-gtk+ gcc-runtime_4.5.1.bb: Fix ICE in gcc-runtime with
-feliminate-dwarf2-dups

 meta/conf/bitbake.conf                         |    8 ++++----
 meta/conf/machine/include/tune-atom.inc        |    4 ----
 meta/recipes-devtools/gcc/gcc-runtime_4.5.1.bb |    7 ++++++-
 3 files changed, 10 insertions(+), 9 deletions(-)
Signature · 1 line
1.7.4.1
author
#1 lore raw

PATCH 1/3 bitbake.conf: Prune global OPTIMIZATION flags

-fexpensive-optimizations is enabled by default at -O2

-fomit-frame-pointer is enabled at -O2 selectively by gcc depending upon
architecture if debug info is not hurt

-frename-registers - This might have some performance advantage on top
of O2 on architectures which have more registers and registers are left after scheduling but it affects debuggability quite a bit so as a i tradeoff we do not use it.

-feliminate-dwarf2-dups - We use this option to reduce the size of debug
information by removing duplicates this is only valid for dwarf2+ and we use dwarf2 by default

-pipe uses buffers instead of temporary files internally it can speed
up compilation it has has issues with other assemblers but not with GNU assembler and we use gas.

Separate out debug information related flags into a separate variable DEBUG_FLAGS so distros can use/notuse them as they like

---
 meta/conf/bitbake.conf |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
meta/conf/bitbake.conf +4 -4
index d5f1fc5..52e66a5 100644
@@ -495,11 +495,11 @@ EXTRA_OEMAKE_prepend_task-compile = "${PARALLEL_MAKE} "
 ##################################################################
 # Optimization flags.
 ##################################################################
-
-FULL_OPTIMIZATION = "-fexpensive-optimizations -fomit-frame-pointer -frename-registers -O2 -ggdb -feliminate-unused-debug-types"
-DEBUG_OPTIMIZATION = "-O -fno-omit-frame-pointer -g"
+DEBUG_FLAGS ?= "-g -feliminate-unused-debug-types -feliminate-dwarf2-dups"
+FULL_OPTIMIZATION = "-O2 -pipe ${DEBUG_FLAGS}"
+DEBUG_OPTIMIZATION = "-O -fno-omit-frame-pointer ${DEBUG_FLAGS} -pipe"
 SELECTED_OPTIMIZATION = "${@bb.data.getVar(['FULL_OPTIMIZATION', 'DEBUG_OPTIMIZATION'][bb.data.getVar('DEBUG_BUILD', d, 1) == '1'], d, 1)}"
-BUILD_OPTIMIZATION = "-O2"
+BUILD_OPTIMIZATION = "-O2 -pipe"
 
 ##################################################################
 # Bootstrap stuff.
Signature · 1 line
1.7.4.1
author
#8 lore raw

PATCH 2/3 machine/include/tune-atom.inc: Remove FULL_OPTIMIZATION_pn-gtk+

In reply to Khem Raj

* Since bitbake.conf has got rid of -fomit-frame-pointer this is no longer required

---
 meta/conf/machine/include/tune-atom.inc |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)
meta/conf/machine/include/tune-atom.inc +0 -4
index 668d028..399ea54 100644
@@ -3,7 +3,3 @@ TARGET_CC_ARCH = "-m32 -march=core2 -msse3 -mtune=generic -mfpmath=sse"
 #MOBLIN_CFLAGS = "-Os -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -fasynchronous-unwind-tables"
 
 PACKAGE_EXTRA_ARCHS = "x86 i386 i486 i586 i686 core2"
-
-# Work around a gcc bug for core2 which caused matchbox-panel to segfault
-# and possibly others.
-FULL_OPTIMIZATION_pn-gtk+ = "-fexpensive-optimizations -frename-registers -O2 -ggdb -feliminate-unused-debug-types"
Signature · 1 line
1.7.4.1
author
#9 lore raw

PATCH 3/3 gcc-runtime_4.5.1.bb: Fix ICE in gcc-runtime with -feliminate-dwarf2-dups

In reply to Khem Raj

GCC 4.5 ends up in an ICE when compiling libstdc++ pre compiled header so we eliminate -feliminate-dwarf2-dups for gcc-runtime

---
 meta/recipes-devtools/gcc/gcc-runtime_4.5.1.bb |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
meta/recipes-devtools/gcc/gcc-runtime_4.5.1.bb +6 -1
index 9eb658b..9d4e158 100644
@@ -1,4 +1,4 @@
-PR = "r4"
+PR = "r5"
 
 require gcc-${PV}.inc
 require gcc-configure-runtime.inc
@@ -9,3 +9,8 @@ SRC_URI_append = "file://fortran-cross-compile-hack.patch"
 ARCH_FLAGS_FOR_TARGET += "-isystem${STAGING_INCDIR}"
 
 EXTRA_OECONF += "--disable-libunwind-exceptions"
+
+# gcc 4.5 ends up in ICE when using -feliminate-dwarf2-dups in libstdc++
+# compiling pre compiled headers so we remove this option when compiling
+# to workaround it
+CXXFLAGS := "${@oe_filter_out('-feliminate-dwarf2-dups', '${CXXFLAGS}', d)}"
Signature · 1 line
1.7.4.1
#10 lore raw
In reply to Khem Raj
Quoted 18 lines · Khem Raj

This patch series is for removing the unneeded flags in SELECTED_OPTIMIZATIONS that gets passed to every recipe build by default. I have also introduced flags to remove duplicate debug information which will reduce the debug info sections

Tested by building and booting console-image/angstrom on ppc,arm,mips,x86-64,x86 qemu machines.

Please apply

Pull URL: git://git.openembedded.org/openembedded-core-contrib
Branch: kraj/global-opts
Browse: http://git.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=kraj/global-opts

Thanks,
Khem Raj <[email protected]>
---

Quoted 5 lines

Khem Raj (3):
bitbake.conf: Prune global OPTIMIZATION flags machine/include/tune-atom.inc: Remove FULL_OPTIMIZATION_pn-gtk+ gcc-runtime_4.5.1.bb: Fix ICE in gcc-runtime with
-feliminate-dwarf2-dups

Merged into master, thanks.

Richard

#2 lore raw

Re: [PATCH 1/3] bitbake.conf: Prune global OPTIMIZATION flags

In reply to Khem Raj

Review

Quoted 13 lines · Khem Raj
(quoted diff) +0 -4
-fexpensive-optimizations is enabled by default at -O2
 
-fomit-frame-pointer is enabled at -O2 selectively by gcc depending upon
  architecture if debug info is not hurt
 
-frename-registers - This might have some performance advantage on top
 of O2 on architectures which have more registers and registers are left
 after scheduling but it affects debuggability quite a bit so as a i
 tradeoff we do not use it.
 
-feliminate-dwarf2-dups - We use this option to reduce the size of debug
 information by removing duplicates this is only valid for dwarf2+ and we
 use dwarf2 by default

I've disabled this flag for now as it was causing too many failures across the board (various apps, prelinker). We can add it back when this has been tested more extensively and its been confirmed to work with the prelinker.

Cheers,

Richard

author
#3 lore raw

Re: [PATCH 1/3] bitbake.conf: Prune global OPTIMIZATION flags

Quoted 11 lines · Richard Purdie
Quoted 10 lines · Khem Raj
(quoted diff) +0 -3
-fexpensive-optimizations is enabled by default at -O2
 
-fomit-frame-pointer is enabled at -O2 selectively by gcc depending upon
  architecture if debug info is not hurt
 
-frename-registers - This might have some performance advantage on top
 of O2 on architectures which have more registers and registers are left
 after scheduling but it affects debuggability quite a bit so as a i
 tradeoff we do not use it.
Quoted 8 lines
Quoted 3 lines

-feliminate-dwarf2-dups - We use this option to reduce the size of debug
information by removing duplicates this is only valid for dwarf2+ and we use dwarf2 by default

I've disabled this flag for now as it was causing too many failures across the board (various apps, prelinker). We can add it back when this has been tested more extensively and its been confirmed to work with the prelinker.

It would have been better to disable one by one we would be able to
utilize current testing. Most probaly the prelink issue is due to -feliminate-dwarf2-dups did you try to remove that out ?

Quoted 10 lines

Cheers,

Richard

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

Signature · 1 line
-Khem
#4 lore raw

Re: [PATCH 1/3] bitbake.conf: Prune global OPTIMIZATION flags

Quoted 21 lines · Khem Raj
Quoted 11 lines · Richard Purdie
Quoted 10 lines · Khem Raj
(quoted diff) +0 -3
-fexpensive-optimizations is enabled by default at -O2
 
-fomit-frame-pointer is enabled at -O2 selectively by gcc depending upon
   architecture if debug info is not hurt
 
-frename-registers - This might have some performance advantage on top
  of O2 on architectures which have more registers and registers are left
  after scheduling but it affects debuggability quite a bit so as a i
  tradeoff we do not use it.
Quoted 8 lines
Quoted 3 lines

-feliminate-dwarf2-dups - We use this option to reduce the size of debug
information by removing duplicates this is only valid for dwarf2+ and we use dwarf2 by default

I've disabled this flag for now as it was causing too many failures across the board (various apps, prelinker). We can add it back when this has been tested more extensively and its been confirmed to work with the prelinker.

Quoted 2 lines

It would have been better to disable one by one we would be able to
utilize current testing. Most probaly the prelink issue is due to -feliminate-dwarf2-dups did you try to remove that out ?

This change, in particular adding -feliminate-dwarf2-dups, breaks my build of chromium(*) (in strange ways, it ends up building .a libraries which the linker can't parse). Everything else I've tried to build seems OK though. For now, I've just dropped this option in my DISTRO.conf

(*) It took quite some time to isolate this as the problem as it is a royal pain to test BTW as it takes more than an hour to build this one package on my hefty build server!

Signature · 4 lines
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------
author
#7 lore raw

Re: [PATCH 1/3] bitbake.conf: Prune global OPTIMIZATION flags

In reply to Khem Raj
Quoted 21 lines · Khem Raj
Quoted 11 lines · Richard Purdie
Quoted 10 lines · Khem Raj
(quoted diff) +0 -2
-fexpensive-optimizations is enabled by default at -O2
 
-fomit-frame-pointer is enabled at -O2 selectively by gcc depending upon

  architecture if debug info is not hurt

-frename-registers - This might have some performance advantage on top of O2 on architectures which have more registers and registers are left after scheduling but it affects debuggability quite a bit so as a i tradeoff we do not use it.

Quoted 8 lines
Quoted 3 lines

-feliminate-dwarf2-dups - We use this option to reduce the size of debug information by removing duplicates this is only valid for dwarf2+ and we use dwarf2 by default

I've disabled this flag for now as it was causing too many failures across the board (various apps, prelinker). We can add it back when this has been tested more extensively and its been confirmed to work with the prelinker.

Quoted 3 lines

It would have been better to disable one by one we would be able to
utilize current testing. Most probaly the prelink issue is due to -feliminate-dwarf2-dups did you try to remove that out ?

To answer myself. I should have looked at the committed patch. :)

Quoted 14 lines
Quoted 10 lines

Cheers,

Richard

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

--
-Khem

author
#5 lore raw

Re: [PATCH 1/3] bitbake.conf: Prune global OPTIMIZATION flags

In reply to Gary Thomas
Quoted 26 lines · Gary Thomas
Quoted 25 lines · Khem Raj
Quoted 22 lines · Richard Purdie
Quoted 11 lines · Khem Raj
(quoted diff) +0 -2
-fexpensive-optimizations is enabled by default at -O2
 
-fomit-frame-pointer is enabled at -O2 selectively by gcc depending upon

  architecture if debug info is not hurt

-frename-registers - This might have some performance advantage on top of O2 on architectures which have more registers and registers are left after scheduling but it affects debuggability quite a bit so as a i tradeoff we do not use it.

Quoted 4 lines

-feliminate-dwarf2-dups - We use this option to reduce the size of debug information by removing duplicates this is only valid for dwarf2+ and we
 use dwarf2 by default

I've disabled this flag for now as it was causing too many failures across the board (various apps, prelinker). We can add it back when this has been tested more extensively and its been confirmed to work with the prelinker.

Quoted 8 lines
Quoted 3 lines

It would have been better to disable one by one we would be able to utilize current testing. Most probaly the prelink issue is due to -feliminate-dwarf2-dups did you try to remove that out ?

This change, in particular adding -feliminate-dwarf2-dups, breaks my build of chromium(*) (in strange ways, it ends up building .a libraries which the linker can't parse).  Everything else I've tried to build seems OK though.  For now, I've just dropped this option in my DISTRO.conf

You dont have to after Richard already dropped it from bitbake.conf its better to stay close enough to defaults

Quoted 5 lines

(*) It took quite some time to isolate this as the problem as it is a royal pain to test BTW as it takes more than an hour to build this one package on my
hefty build server!

hmmm I wonder if its disabling PARALLE_MAKE ?

Quoted 7 lines

--
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------

#6 lore raw

Re: [PATCH 1/3] bitbake.conf: Prune global OPTIMIZATION flags

Quoted 31 lines · Khem Raj
Quoted 30 lines · Gary Thomas
Quoted 28 lines · Khem Raj
Quoted 13 lines · Richard Purdie
Quoted 11 lines · Khem Raj
(quoted diff) +0 -3
-fexpensive-optimizations is enabled by default at -O2
 
-fomit-frame-pointer is enabled at -O2 selectively by gcc depending upon
   architecture if debug info is not hurt
 
-frename-registers - This might have some performance advantage on top
  of O2 on architectures which have more registers and registers are left
  after scheduling but it affects debuggability quite a bit so as a i
  tradeoff we do not use it.
Quoted 9 lines
Quoted 4 lines

-feliminate-dwarf2-dups - We use this option to reduce the size of debug
information by removing duplicates this is only valid for dwarf2+ and
we
use dwarf2 by default

I've disabled this flag for now as it was causing too many failures across the board (various apps, prelinker). We can add it back when this has been tested more extensively and its been confirmed to work with the prelinker.

It would have been better to disable one by one we would be able to utilize current testing. Most probaly the prelink issue is due to -feliminate-dwarf2-dups did you try to remove that out ?

Quoted 7 lines
Quoted 4 lines

This change, in particular adding -feliminate-dwarf2-dups, breaks my build of chromium(*) (in strange ways, it ends up building .a libraries which the linker can't parse). Everything else I've tried to build seems OK though. For now, I've just dropped this option in my DISTRO.conf

You dont have to after Richard already dropped it from bitbake.conf its better to stay close enough to defaults

Absolutely. Thanks, Richard, for moving quickly on this.

Quoted 7 lines
Quoted 5 lines

(*) It took quite some time to isolate this as the problem as it is a royal pain to test BTW as it takes more than an hour to build this one package on my
hefty build server!

hmmm I wonder if its disabling PARALLE_MAKE ?

Nah, it's just *HUGE* - the tmp/work build tree is ~8GB

Signature · 4 lines
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------