diff mbox series

bitbake.conf/webkitgtk: Split debug flag from DEBUG_FLAGS

Message ID 20240711165432.1340223-1-richard.purdie@linuxfoundation.org
State New
Headers show
Series bitbake.conf/webkitgtk: Split debug flag from DEBUG_FLAGS | expand

Commit Message

Richard Purdie July 11, 2024, 4:54 p.m. UTC
Allow the "-g" option in DEBUG_FLAGS to be controlled separately to the rest of
the flags with a new DEBUG_FLAGLEVEL variable. We can then use this in the
webkitgtk recipe for finer grained flag control and it allows the flag to be
unset easily.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 meta/conf/bitbake.conf                       | 3 ++-
 meta/recipes-sato/webkit/webkitgtk_2.44.1.bb | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

Comments

Ross Burton July 11, 2024, 7:05 p.m. UTC | #1
> On 11 Jul 2024, at 17:54, Richard Purdie via lists.openembedded.org <richard.purdie=linuxfoundation.org@lists.openembedded.org> wrote:
> 
> -DEBUG_FLAGS ?= "-g -feliminate-unused-debug-types ${DEBUG_PREFIX_MAP}"
> +DEBUG_LEVELFLAG ?= "-g"
> +DEBUG_FLAGS ?= "${DEBUG_LEVELFLAG} -feliminate-unused-debug-types ${DEBUG_PREFIX_MAP}”

Considering -feliminate-unused-debug-types is the default according to the GCC docs, why don’t we remove DEBUG_FLAGS entirely to remove a level of indirection?  It’s not a huge amount of copy-paste as we can set 

FULL_OPTIMIZATION = "-O2 -pipe ${DEBUG_PREFIX_MAP} ${DEBUG_LEVELFLAG}”
DEBUG_OPTIMIZATION = "-Og -pipe ${DEBUG_PREFIX_MAP} ${DEBUG_LEVELFLAG}”

(also, why is -pipe an optimisation flag?)

I was also thinking a less invasive solution would be to do this in llvm.bb:

DEBUG_FLAGS:append = "${@d.getVar(oe.utils.vartrue('DEBUG_BUILD', '', ‘-g0', d))}”

Ross
Richard Purdie July 11, 2024, 7:30 p.m. UTC | #2
On Thu, 2024-07-11 at 19:05 +0000, Ross Burton wrote:
> 
> 
> > On 11 Jul 2024, at 17:54, Richard Purdie via lists.openembedded.org <richard.purdie=linuxfoundation.org@lists.openembedded.org> wrote:
> > 
> > -DEBUG_FLAGS ?= "-g -feliminate-unused-debug-types ${DEBUG_PREFIX_MAP}"
> > +DEBUG_LEVELFLAG ?= "-g"
> > +DEBUG_FLAGS ?= "${DEBUG_LEVELFLAG} -feliminate-unused-debug-types ${DEBUG_PREFIX_MAP}”
> 
> Considering -feliminate-unused-debug-types is the default according to the GCC 
> docs, why don’t we remove DEBUG_FLAGS entirely to remove a level of indirection?

I think we were an early adopter of that one. If it is a default now we
can drop it.

> It’s not a huge amount of copy-paste as we can set 
> 
> FULL_OPTIMIZATION = "-O2 -pipe ${DEBUG_PREFIX_MAP} ${DEBUG_LEVELFLAG}”
> DEBUG_OPTIMIZATION = "-Og -pipe ${DEBUG_PREFIX_MAP} ${DEBUG_LEVELFLAG}”

It is the prefix map I worry about as some recipes do different things
with DEBUG_FLAGS. Its probably a better long term change but probably
more to debug to make it work.

> (also, why is -pipe an optimisation flag?)

It was controversial back then and was done as a speed improvement.
There is probably more refactoring that could be done here.

> 
> I was also thinking a less invasive solution would be to do this in llvm.bb:
> 
> DEBUG_FLAGS:append = "${@d.getVar(oe.utils.vartrue('DEBUG_BUILD', '', ‘-g0', d))}”

I was trying to keep this as a distro level opt in/out rather than force that decision 
on everyone...

Cheers,

Richard
diff mbox series

Patch

diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index 3ef2deb088b..8d01b5d5327 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -663,7 +663,8 @@  DEBUG_PREFIX_MAP ?= "-fcanon-prefix-map \
  -fmacro-prefix-map=${STAGING_DIR_HOST}= \
  -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
 "
-DEBUG_FLAGS ?= "-g -feliminate-unused-debug-types ${DEBUG_PREFIX_MAP}"
+DEBUG_LEVELFLAG ?= "-g"
+DEBUG_FLAGS ?= "${DEBUG_LEVELFLAG} -feliminate-unused-debug-types ${DEBUG_PREFIX_MAP}"
 
 # Disabled until the option works properly -feliminate-dwarf2-dups
 FULL_OPTIMIZATION = "-O2 -pipe ${DEBUG_FLAGS}"
diff --git a/meta/recipes-sato/webkit/webkitgtk_2.44.1.bb b/meta/recipes-sato/webkit/webkitgtk_2.44.1.bb
index 29e12bb8c5a..a6c1056a23f 100644
--- a/meta/recipes-sato/webkit/webkitgtk_2.44.1.bb
+++ b/meta/recipes-sato/webkit/webkitgtk_2.44.1.bb
@@ -93,7 +93,7 @@  EXTRA_OECMAKE = " \
 
 # Unless DEBUG_BUILD is enabled, pass -g1 to massively reduce the size of the
 # debug symbols (4.3GB to 700M at time of writing)
-DEBUG_FLAGS:append = "${@oe.utils.vartrue('DEBUG_BUILD', '', ' -g1', d)}"
+DEBUG_LEVELFLAG = "${@oe.utils.vartrue('DEBUG_BUILD', '-g', '-g1', d)}"
 
 # Javascript JIT is not supported on ARC
 EXTRA_OECMAKE:append:arc = " -DENABLE_JIT=OFF "