Skip to contentSkip to conversation

bitbake.conf: Make BUILD_OPTIMIZATION respect to DEBUG_BUILD

PATCH In review Robert Yang 3 participants 5 messages Sep 4, 2018 – Sep 5, 2018

lore
Share & tools
lore
#0 lore raw

cover bitbake.conf: Make BUILD_OPTIMIZATION respect to DEBUG_BUILD

The following changes since commit 853e0499be449c71378c087e08b1926be8e2ac87:

ruby: improve reproducibility (2018-08-29 10:40:08 +0100)

are available in the git repository at:

git://git.openembedded.org/openembedded-core-contrib rbt/debug
http://cgit.openembedded.org/openembedded-core-contrib/log/?h=rbt/debug

Robert Yang (1):
bitbake.conf: Make BUILD_OPTIMIZATION respect to DEBUG_BUILD

 meta/conf/bitbake.conf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 bitbake.conf: Make BUILD_OPTIMIZATION respect to DEBUG_BUILD

We may also need debug native tools, so make BUILD_OPTIMIZATION respect to DEBUG_BUILD, otherwise, we need set CFLAGS in the recipe which isn't convenient.

---
 meta/conf/bitbake.conf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/conf/bitbake.conf +1 -1
index 1941633..df62445 100644
@@ -612,7 +612,7 @@ FULL_OPTIMIZATION = "-O2 -pipe ${DEBUG_FLAGS}"
 DEBUG_OPTIMIZATION = "-O -fno-omit-frame-pointer ${DEBUG_FLAGS} -pipe"
 SELECTED_OPTIMIZATION = "${@d.getVar(['FULL_OPTIMIZATION', 'DEBUG_OPTIMIZATION'][d.getVar('DEBUG_BUILD') == '1'])}"
 SELECTED_OPTIMIZATION[vardeps] += "FULL_OPTIMIZATION DEBUG_OPTIMIZATION"
-BUILD_OPTIMIZATION = "-O2 -pipe"
+BUILD_OPTIMIZATION = "${@['-O2', '-O -g -feliminate-unused-debug-types -fno-omit-frame-pointer'][d.getVar('DEBUG_BUILD') == '1']} -pipe"
 
 ##################################################################
 # Settings used by bitbake-layers.
Signature · 1 line
2.7.4
#2 lore raw
Quoted 22 lines

-----Original Message-----
From: [email protected] <openembedded- [email protected]> On Behalf Of Robert Yang
Sent: den 4 september 2018 08:37
To: [email protected]
Subject: [OE-core] [PATCH 1/1] bitbake.conf: Make BUILD_OPTIMIZATION respect to DEBUG_BUILD

We may also need debug native tools, so make BUILD_OPTIMIZATION respect to DEBUG_BUILD, otherwise, we need set CFLAGS in the recipe which isn't convenient.

---
 meta/conf/bitbake.conf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/conf/bitbake.conf +0 -0
index 1941633..df62445 100644

meta/conf/bitbake.conf FULL_OPTIMIZATION = "-O2 -pipe ${DEBUG_FLAGS}" · line 615

Quoted 5 lines
meta/conf/bitbake.conf +1 -1
@@ -612,7 +612,7 @@ FULL_OPTIMIZATION = "-O2 -pipe ${DEBUG_FLAGS}"
 DEBUG_OPTIMIZATION = "-O -fno-omit-frame-pointer ${DEBUG_FLAGS} -pipe"
 SELECTED_OPTIMIZATION = "${@d.getVar(['FULL_OPTIMIZATION', 'DEBUG_OPTIMIZATION'][d.getVar('DEBUG_BUILD') == '1'])}"
 SELECTED_OPTIMIZATION[vardeps] += "FULL_OPTIMIZATION DEBUG_OPTIMIZATION"
-BUILD_OPTIMIZATION = "-O2 -pipe"
+BUILD_OPTIMIZATION = "${@['-O2', '-O -g -feliminate-unused-debug-types -fno-omit-frame-pointer'][d.getVar('DEBUG_BUILD') == '1']} -pipe"

Can we make that more readable:

BUILD_OPTIMIZATION = "${@'-O -g -feliminate-unused-debug-types -fno-omit-frame-pointer' if d.getVar('DEBUG_BUILD') == '1' else '-O2'} -pipe"

Should probably do the same for SELECTED_OPTIMIZATION while at it:

SELECTED_OPTIMIZATION = "${@d.getVar('DEBUG_OPTIMIZATION' if d.getVar('DEBUG_BUILD') == '1' else 'FULL_OPTIMIZATION')}"

Quoted 5 lines
meta/conf/bitbake.conf +0 -1
 ##################################################################
 # Settings used by bitbake-layers.
--

2.7.4

//Peter

#3 lore raw
Quoted 39 lines · Peter Kjellerstedt
Quoted 34 lines

-----Original Message-----
From: [email protected] <openembedded-
[email protected]> On Behalf Of Robert Yang
Sent: den 4 september 2018 08:37
To: [email protected]
Subject: [OE-core] [PATCH 1/1] bitbake.conf: Make BUILD_OPTIMIZATION
respect to DEBUG_BUILD

We may also need debug native tools, so make BUILD_OPTIMIZATION respect to
DEBUG_BUILD, otherwise, we need set CFLAGS in the recipe which isn't
convenient.

---
 meta/conf/bitbake.conf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/conf/bitbake.conf +0 -1
index 1941633..df62445 100644
@@ -612,7 +612,7 @@ FULL_OPTIMIZATION = "-O2 -pipe ${DEBUG_FLAGS}"
 DEBUG_OPTIMIZATION = "-O -fno-omit-frame-pointer ${DEBUG_FLAGS}
-pipe"
 SELECTED_OPTIMIZATION = "${@d.getVar(['FULL_OPTIMIZATION',

'DEBUG_OPTIMIZATION'][d.getVar('DEBUG_BUILD') == '1'])}"
SELECTED_OPTIMIZATION[vardeps] += "FULL_OPTIMIZATION
DEBUG_OPTIMIZATION"

meta/conf/bitbake.conf +1 -1
-BUILD_OPTIMIZATION = "-O2 -pipe"
+BUILD_OPTIMIZATION = "${@['-O2', '-O -g -feliminate-unused-debug-
Quoted 2 lines

types -fno-omit-frame-pointer'][d.getVar('DEBUG_BUILD') == '1']} -pipe"

Can we make that more readable:

Quoted 8 lines

BUILD_OPTIMIZATION = "${@'-O -g -feliminate-unused-debug-types -fno- omit-frame-pointer' if d.getVar('DEBUG_BUILD') == '1' else '-O2'} -pipe"

Should probably do the same for SELECTED_OPTIMIZATION while at it:

SELECTED_OPTIMIZATION = "${@d.getVar('DEBUG_OPTIMIZATION' if d.getVar('DEBUG_BUILD') == '1' else 'FULL_OPTIMIZATION')}"

If we're going to deal with readability and usability we could add something like:

def vartrue(var, iftrue, iffalse, d):
if oe.types.boolean(d.getVar(var)):
return iftrue
else:
return iffalse

to lib/oe/utils and then:

BUILD_OPTIMIZATION = "${@oe.utils.vartrue('DEBUG_BUILD', '-O -g -feliminate-unused-debug-types -fno-omit-frame-pointer', '-O2', d)}"

Cheers,

Richard

#4 lore raw
Quoted 49 lines · Richard Purdie
Quoted 39 lines · Peter Kjellerstedt
Quoted 34 lines

-----Original Message-----
From: [email protected] <openembedded-
[email protected]> On Behalf Of Robert Yang
Sent: den 4 september 2018 08:37
To: [email protected]
Subject: [OE-core] [PATCH 1/1] bitbake.conf: Make BUILD_OPTIMIZATION
respect to DEBUG_BUILD

We may also need debug native tools, so make BUILD_OPTIMIZATION respect to
DEBUG_BUILD, otherwise, we need set CFLAGS in the recipe which isn't
convenient.

---
  meta/conf/bitbake.conf | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
meta/conf/bitbake.conf +0 -1
index 1941633..df62445 100644
@@ -612,7 +612,7 @@ FULL_OPTIMIZATION = "-O2 -pipe ${DEBUG_FLAGS}"
  DEBUG_OPTIMIZATION = "-O -fno-omit-frame-pointer ${DEBUG_FLAGS}
-pipe"
  SELECTED_OPTIMIZATION = "${@d.getVar(['FULL_OPTIMIZATION',

'DEBUG_OPTIMIZATION'][d.getVar('DEBUG_BUILD') == '1'])}"
SELECTED_OPTIMIZATION[vardeps] += "FULL_OPTIMIZATION
DEBUG_OPTIMIZATION"

meta/conf/bitbake.conf +1 -1
-BUILD_OPTIMIZATION = "-O2 -pipe"
+BUILD_OPTIMIZATION = "${@['-O2', '-O -g -feliminate-unused-debug-
Quoted 2 lines

types -fno-omit-frame-pointer'][d.getVar('DEBUG_BUILD') == '1']} -pipe"

Can we make that more readable:

Quoted 8 lines

BUILD_OPTIMIZATION = "${@'-O -g -feliminate-unused-debug-types -fno- omit-frame-pointer' if d.getVar('DEBUG_BUILD') == '1' else '-O2'} -pipe"

Should probably do the same for SELECTED_OPTIMIZATION while at it:

SELECTED_OPTIMIZATION = "${@d.getVar('DEBUG_OPTIMIZATION' if d.getVar('DEBUG_BUILD') == '1' else 'FULL_OPTIMIZATION')}"

Quoted 8 lines

If we're going to deal with readability and usability we could add something like:

def vartrue(var, iftrue, iffalse, d):
if oe.types.boolean(d.getVar(var)):
return iftrue
else:
return iffalse

Thanks, looks good, I will send a V2.

// Robert

Quoted 10 lines

to lib/oe/utils and then:

BUILD_OPTIMIZATION = "${@oe.utils.vartrue('DEBUG_BUILD', '-O -g -feliminate-unused-debug-types -fno-omit-frame-pointer', '-O2', d)}"

Cheers,

Richard