Skip to contentSkip to conversation

thumb tune feature improvements

RFC PATCH In review Martin Jansa 1 participant 10 messages Jan 22, 2014 – Jan 31, 2014

lore
Share & tools
lore
#0 lore raw

cover thumb tune feature improvements

Only first patch was properly tested, the rest is just something I've noticed when looking at feature-arm-thumb.inc and there was similar request from Andrei last week

http://lists.openembedded.org/pipermail/openembedded-core/2014-January/088207.html

The following changes since commit 4659d29b1040349116549644e45035a5b37d9311:

sstate.bbclass: remove previous version's stamp (2014-01-21 10:36:23 +0000)

are available in the git repository at:

git://git.openembedded.org/openembedded-core-contrib jansa/tune
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=jansa/tune

Andrei Gherzan (1):
tune-cortexm3.inc: Cortex-M3 doesn't support ARM instructions

Martin Jansa (5):
feature-arm-thumb.inc: Fix missing t2 suffix for armv7a MACHINEs feature-arm-thumb.inc: Replace inner quotes with apostrophes feature-arm-thumb.inc: respect ARM_INSTRUCTION_SET when adding thumb
suffix
feature-arm-thumb.inc, arch-armv4.inc: Add "arm" to TUNE_FEATURES tune-cortexr4.inc: Add thumb and arm to TUNE_FEATURES

 meta/conf/machine/include/arm/arch-armv4.inc       |  2 +-
 .../conf/machine/include/arm/feature-arm-thumb.inc | 30 ++++++++++++++--------
 meta/conf/machine/include/tune-cortexm3.inc        |  2 +-
 meta/conf/machine/include/tune-cortexr4.inc        |  2 +-
 4 files changed, 23 insertions(+), 13 deletions(-)
Signature · 1 line
1.8.5.3
#1 lore raw

RFC PATCH 1/6 feature-arm-thumb.inc: Fix missing t2 suffix for armv7a MACHINEs

* unfortunatelly that note about armv7 matching also armv7a is no longer valid since armv7 include in armv7a was replaced with armv6+neon in this commit:

commit 75b8adbc042e0f65fb1286bc550d02becd3b6aea
Author: Khem Raj <[email protected]>
Date: Tue Mar 27 18:37:45 2012 -0700

tune/armv7: Delete

since then thumb and arm feeds had the same architecture
* be aware that this will rename lots of feeds

---
 meta/conf/machine/include/arm/feature-arm-thumb.inc | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
meta/conf/machine/include/arm/feature-arm-thumb.inc +1 -2
index bd754be..fa3a4e5 100644
@@ -9,11 +9,10 @@ ARM_THUMB_M_OPT = "${@['-marm', '-mthumb'][d.getVar('ARM_INSTRUCTION_SET', True)
 TUNE_CCARGS .= "${@bb.utils.contains("TUNE_FEATURES", "thumb", " ${ARM_THUMB_M_OPT}", "", d)}"
 OVERRIDES .= "${@bb.utils.contains("TUNE_FEATURES", "thumb", ":thumb", "", d)}"
 
-# Note armv7 will hit on armv7a as well
 ARMPKGSFX_THUMB .= "${@bb.utils.contains("TUNE_FEATURES", [ "armv4", "thumb" ], "t", "", d)}"
 ARMPKGSFX_THUMB .= "${@bb.utils.contains("TUNE_FEATURES", [ "armv5", "thumb" ], "t", "", d)}"
 ARMPKGSFX_THUMB .= "${@bb.utils.contains("TUNE_FEATURES", [ "armv6", "thumb" ], "t", "", d)}"
-ARMPKGSFX_THUMB .= "${@bb.utils.contains("TUNE_FEATURES", [ "armv7", "thumb" ], "t2", "", d)}"
+ARMPKGSFX_THUMB .= "${@bb.utils.contains("TUNE_FEATURES", [ "armv7a", "thumb" ], "t2", "", d)}"
 
 # Whether to compile with code to allow interworking between the two
 # instruction sets. This allows thumb code to be executed on a primarily
Signature · 1 line
1.8.5.3
#2 lore raw

RFC PATCH 2/6 feature-arm-thumb.inc: Replace inner quotes with apostrophes

In reply to Martin Jansa

* so that it's highlighted correctly

---
 meta/conf/machine/include/arm/feature-arm-thumb.inc | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
meta/conf/machine/include/arm/feature-arm-thumb.inc +8 -8
index fa3a4e5..d58c4b4 100644
@@ -6,20 +6,20 @@
 # slower.
 TUNEVALID[thumb] = "Use thumb instructions instead of ARM"
 ARM_THUMB_M_OPT = "${@['-marm', '-mthumb'][d.getVar('ARM_INSTRUCTION_SET', True) == 'thumb']}"
-TUNE_CCARGS .= "${@bb.utils.contains("TUNE_FEATURES", "thumb", " ${ARM_THUMB_M_OPT}", "", d)}"
-OVERRIDES .= "${@bb.utils.contains("TUNE_FEATURES", "thumb", ":thumb", "", d)}"
+TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'thumb', ' ${ARM_THUMB_M_OPT}', '', d)}"
+OVERRIDES .= "${@bb.utils.contains('TUNE_FEATURES', 'thumb', ':thumb', '', d)}"
 
-ARMPKGSFX_THUMB .= "${@bb.utils.contains("TUNE_FEATURES", [ "armv4", "thumb" ], "t", "", d)}"
-ARMPKGSFX_THUMB .= "${@bb.utils.contains("TUNE_FEATURES", [ "armv5", "thumb" ], "t", "", d)}"
-ARMPKGSFX_THUMB .= "${@bb.utils.contains("TUNE_FEATURES", [ "armv6", "thumb" ], "t", "", d)}"
-ARMPKGSFX_THUMB .= "${@bb.utils.contains("TUNE_FEATURES", [ "armv7a", "thumb" ], "t2", "", d)}"
+ARMPKGSFX_THUMB .= "${@bb.utils.contains('TUNE_FEATURES', [ 'armv4', 'thumb' ], 't', '', d)}"
+ARMPKGSFX_THUMB .= "${@bb.utils.contains('TUNE_FEATURES', [ 'armv5', 'thumb' ], 't', '', d)}"
+ARMPKGSFX_THUMB .= "${@bb.utils.contains('TUNE_FEATURES', [ 'armv6', 'thumb' ], 't', '', d)}"
+ARMPKGSFX_THUMB .= "${@bb.utils.contains('TUNE_FEATURES', [ 'armv7a', 'thumb' ], 't2', '', d)}"
 
 # Whether to compile with code to allow interworking between the two
 # instruction sets. This allows thumb code to be executed on a primarily
 # arm system and vice versa. It is strongly recommended that DISTROs not
 # turn this off - the actual cost is very small.
 TUNEVALID[no-thumb-interwork] = "Disable mixing of thumb and ARM functions"
-TUNE_CCARGS .= "${@bb.utils.contains("TUNE_FEATURES", "no-thumb-interwork", " -mno-thumb-interwork", " -mthumb-interwork", d)}"
-OVERRIDES .= "${@bb.utils.contains("TUNE_FEATURES", "no-thumb-interwork", ":thumb-interwork", "", d)}"
+TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'no-thumb-interwork', ' -mno-thumb-interwork', ' -mthumb-interwork', d)}"
+OVERRIDES .= "${@bb.utils.contains('TUNE_FEATURES', 'no-thumb-interwork', ':thumb-interwork', '', d)}"
 
 TARGET_CC_KERNEL_ARCH += "-mno-thumb-interwork -marm"
Signature · 1 line
1.8.5.3
#3 lore raw

RFC PATCH 3/6 feature-arm-thumb.inc: respect ARM_INSTRUCTION_SET when adding thumb suffix

In reply to Martin Jansa

* this means that recipes with ARM_INSTRUCTION_SET explicitly changed to arm will be built in feed without thumb suffix
* I'm not sure if the rest of system correctly supports different TUNE_PKGARCHs for different recipes, this is one of the reasons why this is WIP/RFC

---
 meta/conf/machine/include/arm/feature-arm-thumb.inc | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
meta/conf/machine/include/arm/feature-arm-thumb.inc +11 -6
index d58c4b4..09a127a 100644
@@ -5,14 +5,19 @@
 # but requires more instructions (140% for 70% smaller code) so may be
 # slower.
 TUNEVALID[thumb] = "Use thumb instructions instead of ARM"
-ARM_THUMB_M_OPT = "${@['-marm', '-mthumb'][d.getVar('ARM_INSTRUCTION_SET', True) == 'thumb']}"
-TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'thumb', ' ${ARM_THUMB_M_OPT}', '', d)}"
+ARM_THUMB_OPT = "${@['arm', 'thumb'][d.getVar('ARM_INSTRUCTION_SET', True) == 'thumb']}"
+ARM_THUMB_SUFFIX .= "${@bb.utils.contains('TUNE_FEATURES', 'armv4',  't',  '', d)}"
+ARM_THUMB_SUFFIX .= "${@bb.utils.contains('TUNE_FEATURES', 'armv5',  't',  '', d)}"
+ARM_THUMB_SUFFIX .= "${@bb.utils.contains('TUNE_FEATURES', 'armv6',  't',  '', d)}"
+ARM_THUMB_SUFFIX .= "${@bb.utils.contains('TUNE_FEATURES', 'armv7a', 't2', '', d)}"
+ARM_THUMB_SUFFIX .= "${@bb.utils.contains('TUNE_FEATURES', 'armv7r', 't2', '', d)}"
+ARM_THUMB_SUFFIX .= "${@bb.utils.contains('TUNE_FEATURES', 'armv7m', 't2', '', d)}"
+
+TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'thumb', ' -m${ARM_THUMB_OPT}', '', d)}"
 OVERRIDES .= "${@bb.utils.contains('TUNE_FEATURES', 'thumb', ':thumb', '', d)}"
 
-ARMPKGSFX_THUMB .= "${@bb.utils.contains('TUNE_FEATURES', [ 'armv4', 'thumb' ], 't', '', d)}"
-ARMPKGSFX_THUMB .= "${@bb.utils.contains('TUNE_FEATURES', [ 'armv5', 'thumb' ], 't', '', d)}"
-ARMPKGSFX_THUMB .= "${@bb.utils.contains('TUNE_FEATURES', [ 'armv6', 'thumb' ], 't', '', d)}"
-ARMPKGSFX_THUMB .= "${@bb.utils.contains('TUNE_FEATURES', [ 'armv7a', 'thumb' ], 't2', '', d)}"
+# Add suffix from ARM_THUMB_SUFFIX only if after all this we still set ARM_THUMB_OPT to thumb
+ARMPKGSFX_THUMB .= "${@ d.getVar('ARM_THUMB_SUFFIX', True) if d.getVar('ARM_THUMB_OPT', True) == 'thumb'] else ''}"
 
 # Whether to compile with code to allow interworking between the two
 # instruction sets. This allows thumb code to be executed on a primarily
Signature · 1 line
1.8.5.3
#7 lore raw

RFC PATCH 4/6 feature-arm-thumb.inc, arch-armv4.inc: Add "arm" to TUNE_FEATURES

In reply to Martin Jansa

* it will be inherited by all higher architectures, except few exceptions which support only thumb and not arm
* respect missing "arm" in TUNE_FEATURES in feature-arm-thumb.inc

---
 meta/conf/machine/include/arm/arch-armv4.inc        |  2 +-
 meta/conf/machine/include/arm/feature-arm-thumb.inc | 12 +++++++++---
 2 files changed, 10 insertions(+), 4 deletions(-)
meta/conf/machine/include/arm/arch-armv4.inc +1 -1
index c33c816..4b43e9f 100644
@@ -18,7 +18,7 @@ require conf/machine/include/arm/feature-arm-thumb.inc
 AVAILTUNES += "armv4 armv4t"
 ARMPKGARCH_tune-armv4 ?= "armv4"
 ARMPKGARCH_tune-armv4t ?= "armv4"
-TUNE_FEATURES_tune-armv4 ?= "armv4"
+TUNE_FEATURES_tune-armv4 ?= "arm armv4"
 TUNE_FEATURES_tune-armv4t ?= "${TUNE_FEATURES_tune-armv4} thumb"
 PACKAGE_EXTRA_ARCHS_tune-armv4 = "arm armv4"
 PACKAGE_EXTRA_ARCHS_tune-armv4t = "${PACKAGE_EXTRA_ARCHS_tune-armv4} armv4t"
meta/conf/machine/include/arm/feature-arm-thumb.inc +9 -3
index 09a127a..aaa39dc 100644
@@ -13,11 +13,17 @@ ARM_THUMB_SUFFIX .= "${@bb.utils.contains('TUNE_FEATURES', 'armv7a', 't2', '', d
 ARM_THUMB_SUFFIX .= "${@bb.utils.contains('TUNE_FEATURES', 'armv7r', 't2', '', d)}"
 ARM_THUMB_SUFFIX .= "${@bb.utils.contains('TUNE_FEATURES', 'armv7m', 't2', '', d)}"
 
-TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'thumb', ' -m${ARM_THUMB_OPT}', '', d)}"
+# If the device supports ARM, then respect ARM_THUMB_OPT
+# If the defice doesn't support ARM, then always set "thumb" even when
+# some recipe explicitly sets ARM_INSTRUCTION_SET to "arm"
+# (maybe we should show warning in this case)
+ARM_M_OPT = "${@bb.utils.contains('TUNE_FEATURES', 'arm', '${ARM_THUMB_OPT}', 'thumb', d)}"
+
+TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'thumb', ' -m${ARM_M_OPT}', '', d)}"
 OVERRIDES .= "${@bb.utils.contains('TUNE_FEATURES', 'thumb', ':thumb', '', d)}"
 
-# Add suffix from ARM_THUMB_SUFFIX only if after all this we still set ARM_THUMB_OPT to thumb
-ARMPKGSFX_THUMB .= "${@ d.getVar('ARM_THUMB_SUFFIX', True) if d.getVar('ARM_THUMB_OPT', True) == 'thumb'] else ''}"
+# Add suffix from ARM_THUMB_SUFFIX only if after all this we still set ARM_M_OPT to thumb
+ARMPKGSFX_THUMB .= "${@ d.getVar('ARM_THUMB_SUFFIX', True) if d.getVar('ARM_M_OPT', True) == 'thumb'] else ''}"
 
 # Whether to compile with code to allow interworking between the two
 # instruction sets. This allows thumb code to be executed on a primarily
Signature · 1 line
1.8.5.3
#8 lore raw

RFC PATCH 5/6 tune-cortexr4.inc: Add thumb and arm to TUNE_FEATURES

In reply to Martin Jansa
---
 meta/conf/machine/include/tune-cortexr4.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/conf/machine/include/tune-cortexr4.inc +1 -1
index 57b6717..bde649f 100644
@@ -10,5 +10,5 @@ TUNE_CCARGS .= "${@bb.utils.contains("TUNE_FEATURES", "armv7r", " -march=armv7-r
 
 AVAILTUNES += "cortexr4"
 ARMPKGARCH_tune-cortexr4 = "armv7r"
-TUNE_FEATURES_tune-cortexr4 = "armv7r vfp cortexr4"
+TUNE_FEATURES_tune-cortexr4 = "armv7r vfp cortexr4 arm thumb"
 PACKAGE_EXTRA_ARCHS_tune-cortexr4 = "${PACKAGE_EXTRA_ARCHS_tune-armv7at} armv7r-vfp"
Signature · 1 line
1.8.5.3
#9 lore raw

RFC PATCH 6/6 tune-cortexm3.inc: Cortex-M3 doesn't support ARM instructions

In reply to Martin Jansa

From: Andrei Gherzan <[email protected]>

Use thumb instructions for Cortex-M3 to avoid this gcc error:
'error: target CPU does not support ARM mode'.

Extracted from "Cortex-M3 Technical Reference Manual":
"The processor implements the ARM v7-M architecture. This includes the entire 16-bit Thumb instruction set and the base Thumb-2 32-bit instruction set architecture. The processor cannot execute ARM instructions."

---
 meta/conf/machine/include/tune-cortexm3.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/conf/machine/include/tune-cortexm3.inc +1 -1
index cbc4c0d..780baf4 100644
@@ -10,5 +10,5 @@ TUNE_CCARGS .= "${@bb.utils.contains("TUNE_FEATURES", "armv7m", " -march=armv7-m
 
 AVAILTUNES += "cortexm3"
 ARMPKGARCH_tune-cortexm3 = "armv7m"
-TUNE_FEATURES_tune-cortexm3 = "armv7m vfp cortexm3"
+TUNE_FEATURES_tune-cortexm3 = "armv7m vfp cortexm3 thumb"
 PACKAGE_EXTRA_ARCHS_tune-cortexm3 = "${PACKAGE_EXTRA_ARCHS_tune-armv7at} armv7m-vfp"
Signature · 1 line
1.8.5.3
#4 lore raw

Re: [PATCH][RFC][WIP 3/6] feature-arm-thumb.inc: respect ARM_INSTRUCTION_SET when adding thumb suffix

In reply to Martin Jansa
Quoted 28 lines · Martin Jansa

* this means that recipes with ARM_INSTRUCTION_SET explicitly changed to arm will be built in feed without thumb suffix
* I'm not sure if the rest of system correctly supports different TUNE_PKGARCHs for different recipes, this is one of the reasons why this is WIP/RFC

---
 meta/conf/machine/include/arm/feature-arm-thumb.inc | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
meta/conf/machine/include/arm/feature-arm-thumb.inc +7 -2
index d58c4b4..09a127a 100644
@@ -5,14 +5,19 @@
 # but requires more instructions (140% for 70% smaller code) so may be
 # slower.
 TUNEVALID[thumb] = "Use thumb instructions instead of ARM"
-ARM_THUMB_M_OPT = "${@['-marm', '-mthumb'][d.getVar('ARM_INSTRUCTION_SET', True) == 'thumb']}"
-TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'thumb', ' ${ARM_THUMB_M_OPT}', '', d)}"
+ARM_THUMB_OPT = "${@['arm', 'thumb'][d.getVar('ARM_INSTRUCTION_SET', True) == 'thumb']}"
+ARM_THUMB_SUFFIX .= "${@bb.utils.contains('TUNE_FEATURES', 'armv4',  't',  '', d)}"
+ARM_THUMB_SUFFIX .= "${@bb.utils.contains('TUNE_FEATURES', 'armv5',  't',  '', d)}"
+ARM_THUMB_SUFFIX .= "${@bb.utils.contains('TUNE_FEATURES', 'armv6',  't',  '', d)}"
+ARM_THUMB_SUFFIX .= "${@bb.utils.contains('TUNE_FEATURES', 'armv7a', 't2', '', d)}"
+ARM_THUMB_SUFFIX .= "${@bb.utils.contains('TUNE_FEATURES', 'armv7r', 't2', '', d)}"
+ARM_THUMB_SUFFIX .= "${@bb.utils.contains('TUNE_FEATURES', 'armv7m', 't2', '', d)}"

meta/conf/machine/include/arm/feature-arm-thumb.inc line 20

Quoted 10 lines
meta/conf/machine/include/arm/feature-arm-thumb.inc +4 -4
+
+TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'thumb', ' -m${ARM_THUMB_OPT}', '', d)}"
 OVERRIDES .= "${@bb.utils.contains('TUNE_FEATURES', 'thumb', ':thumb', '', d)}"
 
-ARMPKGSFX_THUMB .= "${@bb.utils.contains('TUNE_FEATURES', [ 'armv4', 'thumb' ], 't', '', d)}"
-ARMPKGSFX_THUMB .= "${@bb.utils.contains('TUNE_FEATURES', [ 'armv5', 'thumb' ], 't', '', d)}"
-ARMPKGSFX_THUMB .= "${@bb.utils.contains('TUNE_FEATURES', [ 'armv6', 'thumb' ], 't', '', d)}"
-ARMPKGSFX_THUMB .= "${@bb.utils.contains('TUNE_FEATURES', [ 'armv7a', 'thumb' ], 't2', '', d)}"
+# Add suffix from ARM_THUMB_SUFFIX only if after all this we still set ARM_THUMB_OPT to thumb
+ARMPKGSFX_THUMB .= "${@ d.getVar('ARM_THUMB_SUFFIX', True) if d.getVar('ARM_THUMB_OPT', True) == 'thumb'] else ''}"

In branch I've removed extra ']' in this line and moved this patch as last in series, because it's really not ready for merge (eglibc-initial fails).

Any other comments before I send v2?

Quoted 5 lines
meta/conf/machine/include/arm/feature-arm-thumb.inc +0 -0
 # Whether to compile with code to allow interworking between the two
 # instruction sets. This allows thumb code to be executed on a primarily
Signature · 1 line
1.8.5.3
Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]
#5 lore raw

Re: [PATCH][RFC][WIP 3/6] feature-arm-thumb.inc: respect ARM_INSTRUCTION_SET when adding thumb suffix

Quoted 33 lines · Martin Jansa
Quoted 32 lines · Martin Jansa

* this means that recipes with ARM_INSTRUCTION_SET explicitly changed to arm will be built in feed without thumb suffix
* I'm not sure if the rest of system correctly supports different TUNE_PKGARCHs for different recipes, this is one of the reasons why this is WIP/RFC

---
 meta/conf/machine/include/arm/feature-arm-thumb.inc | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
meta/conf/machine/include/arm/feature-arm-thumb.inc +9 -2
index d58c4b4..09a127a 100644
@@ -5,14 +5,19 @@
 # but requires more instructions (140% for 70% smaller code) so may be
 # slower.
 TUNEVALID[thumb] = "Use thumb instructions instead of ARM"
-ARM_THUMB_M_OPT = "${@['-marm', '-mthumb'][d.getVar('ARM_INSTRUCTION_SET', True) == 'thumb']}"
-TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'thumb', ' ${ARM_THUMB_M_OPT}', '', d)}"
+ARM_THUMB_OPT = "${@['arm', 'thumb'][d.getVar('ARM_INSTRUCTION_SET', True) == 'thumb']}"
+ARM_THUMB_SUFFIX .= "${@bb.utils.contains('TUNE_FEATURES', 'armv4',  't',  '', d)}"
+ARM_THUMB_SUFFIX .= "${@bb.utils.contains('TUNE_FEATURES', 'armv5',  't',  '', d)}"
+ARM_THUMB_SUFFIX .= "${@bb.utils.contains('TUNE_FEATURES', 'armv6',  't',  '', d)}"
+ARM_THUMB_SUFFIX .= "${@bb.utils.contains('TUNE_FEATURES', 'armv7a', 't2', '', d)}"
+ARM_THUMB_SUFFIX .= "${@bb.utils.contains('TUNE_FEATURES', 'armv7r', 't2', '', d)}"
+ARM_THUMB_SUFFIX .= "${@bb.utils.contains('TUNE_FEATURES', 'armv7m', 't2', '', d)}"
+
+TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'thumb', ' -m${ARM_THUMB_OPT}', '', d)}"
 OVERRIDES .= "${@bb.utils.contains('TUNE_FEATURES', 'thumb', ':thumb', '', d)}"
 
Quoted 10 lines

meta/conf/machine/include/arm/feature-arm-thumb.inc line 20

Quoted 6 lines
meta/conf/machine/include/arm/feature-arm-thumb.inc +2 -4
-ARMPKGSFX_THUMB .= "${@bb.utils.contains('TUNE_FEATURES', [ 'armv4', 'thumb' ], 't', '', d)}"
-ARMPKGSFX_THUMB .= "${@bb.utils.contains('TUNE_FEATURES', [ 'armv5', 'thumb' ], 't', '', d)}"
-ARMPKGSFX_THUMB .= "${@bb.utils.contains('TUNE_FEATURES', [ 'armv6', 'thumb' ], 't', '', d)}"
-ARMPKGSFX_THUMB .= "${@bb.utils.contains('TUNE_FEATURES', [ 'armv7a', 'thumb' ], 't2', '', d)}"
+# Add suffix from ARM_THUMB_SUFFIX only if after all this we still set ARM_THUMB_OPT to thumb
+ARMPKGSFX_THUMB .= "${@ d.getVar('ARM_THUMB_SUFFIX', True) if d.getVar('ARM_THUMB_OPT', True) == 'thumb'] else ''}"

In branch I've removed extra ']' in this line and moved this patch as last in series, because it's really not ready for merge (eglibc-initial fails).

Ah, there was another issue in 4/6 and "arm" TUNE_FEATURE wasn't inherited by higher architectures, so it was correctly forcing "thumb" mode - that's why eglibc-initial was failing and now it isn't.

Quoted 10 lines

Any other comments before I send v2?

Quoted 5 lines
meta/conf/machine/include/arm/feature-arm-thumb.inc +0 -0
 # Whether to compile with code to allow interworking between the two
 # instruction sets. This allows thumb code to be executed on a primarily
Signature · 1 line
1.8.5.3
Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]
Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]
#6 lore raw

Re: [PATCH][RFC][WIP 3/6] feature-arm-thumb.inc: respect ARM_INSTRUCTION_SET when adding thumb suffix

Quoted 45 lines · Martin Jansa
Quoted 33 lines · Martin Jansa
Quoted 32 lines · Martin Jansa

* this means that recipes with ARM_INSTRUCTION_SET explicitly changed to arm will be built in feed without thumb suffix
* I'm not sure if the rest of system correctly supports different TUNE_PKGARCHs for different recipes, this is one of the reasons why this is WIP/RFC

---
 meta/conf/machine/include/arm/feature-arm-thumb.inc | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
meta/conf/machine/include/arm/feature-arm-thumb.inc +9 -2
index d58c4b4..09a127a 100644
@@ -5,14 +5,19 @@
 # but requires more instructions (140% for 70% smaller code) so may be
 # slower.
 TUNEVALID[thumb] = "Use thumb instructions instead of ARM"
-ARM_THUMB_M_OPT = "${@['-marm', '-mthumb'][d.getVar('ARM_INSTRUCTION_SET', True) == 'thumb']}"
-TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'thumb', ' ${ARM_THUMB_M_OPT}', '', d)}"
+ARM_THUMB_OPT = "${@['arm', 'thumb'][d.getVar('ARM_INSTRUCTION_SET', True) == 'thumb']}"
+ARM_THUMB_SUFFIX .= "${@bb.utils.contains('TUNE_FEATURES', 'armv4',  't',  '', d)}"
+ARM_THUMB_SUFFIX .= "${@bb.utils.contains('TUNE_FEATURES', 'armv5',  't',  '', d)}"
+ARM_THUMB_SUFFIX .= "${@bb.utils.contains('TUNE_FEATURES', 'armv6',  't',  '', d)}"
+ARM_THUMB_SUFFIX .= "${@bb.utils.contains('TUNE_FEATURES', 'armv7a', 't2', '', d)}"
+ARM_THUMB_SUFFIX .= "${@bb.utils.contains('TUNE_FEATURES', 'armv7r', 't2', '', d)}"
+ARM_THUMB_SUFFIX .= "${@bb.utils.contains('TUNE_FEATURES', 'armv7m', 't2', '', d)}"
+
+TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'thumb', ' -m${ARM_THUMB_OPT}', '', d)}"
 OVERRIDES .= "${@bb.utils.contains('TUNE_FEATURES', 'thumb', ':thumb', '', d)}"
 
Quoted 10 lines

meta/conf/machine/include/arm/feature-arm-thumb.inc line 20

Quoted 6 lines
meta/conf/machine/include/arm/feature-arm-thumb.inc +2 -4
-ARMPKGSFX_THUMB .= "${@bb.utils.contains('TUNE_FEATURES', [ 'armv4', 'thumb' ], 't', '', d)}"
-ARMPKGSFX_THUMB .= "${@bb.utils.contains('TUNE_FEATURES', [ 'armv5', 'thumb' ], 't', '', d)}"
-ARMPKGSFX_THUMB .= "${@bb.utils.contains('TUNE_FEATURES', [ 'armv6', 'thumb' ], 't', '', d)}"
-ARMPKGSFX_THUMB .= "${@bb.utils.contains('TUNE_FEATURES', [ 'armv7a', 'thumb' ], 't2', '', d)}"
+# Add suffix from ARM_THUMB_SUFFIX only if after all this we still set ARM_THUMB_OPT to thumb
+ARMPKGSFX_THUMB .= "${@ d.getVar('ARM_THUMB_SUFFIX', True) if d.getVar('ARM_THUMB_OPT', True) == 'thumb'] else ''}"

In branch I've removed extra ']' in this line and moved this patch as last in series, because it's really not ready for merge (eglibc-initial fails).

Quoted 3 lines

Ah, there was another issue in 4/6 and "arm" TUNE_FEATURE wasn't inherited by higher architectures, so it was correctly forcing "thumb" mode - that's why eglibc-initial was failing and now it isn't.

OMG sorry for noise, yes there is still problem when missing thumb and arm builds for the same machine with different PKGARCH and eglibc-initial still fails

| checking build system type... x86_64-pc-linux-gnu
| checking host system type... arm-oe-linux-gnueabi
| checking for arm-oe-linux-gnueabi-gcc... arm-oe-linux-gnueabi-gcc  -march=armv5e -marm -mthumb-interwork --sysroot=/OE/build/oe-core/tmp-eglibc/sysroots/qemuarm
| checking for suffix of object files... configure: error: in `/OE/build/oe-core/tmp-eglibc/work/armv5e-oe-linux-gnueabi/eglibc-initial/2.18-r0/build-arm-oe-linux-gnueabi':
| configure: error: cannot compute suffix of object files: cannot compile
| See `config.log' for more details
| WARNING: /OE/build/oe-core/tmp-eglibc/work/armv5e-oe-linux-gnueabi/eglibc-initial/2.18-r0/temp/run.do_configure.3925:1 exit 1 from
|   /OE/build/oe-core/tmp-eglibc/work/armv5e-oe-linux-gnueabi/eglibc-initial/2.18-r0/eglibc-2.18/libc/configure --host=arm-oe-linux-gnueabi --build=x86_64-linux --prefix=/usr --without-cvs --disable-sanity-checks --with-headers=/OE/build/oe-core/tmp-eglibc/sysroots/qemuarm/usr/include --with-kconfig=/OE/build/oe-core/tmp-eglibc/sysroots/x86_64-linux/usr/bin --enable-hacker-mode --enable-addons

config.log:
configure:2768: arm-oe-linux-gnueabi-gcc -march=armv5e -marm -mthumb-interwork --sysroot=/OE/build/oe-core/tmp-eglibc/sysroots/qemuarm -c -O2 -pipe -g -feliminate-unused-debug-types conftest.c >&5 /OE/build/oe-core/tmp-eglibc/work/armv5e-oe-linux-gnueabi/eglibc-initial/2.18-r0/eglibc-2.18/libc/configure: line 2770: arm-oe-linux-gnueabi-gcc: command not found configure:2772: $? = 127

and the problem is basically that STAGING_BINDIR_TOOLCHAIN points to different directory when building recipe with thumb enabled and disabled, in this case gcc was built with thumb enabled and is installed in:

sysroots/x86_64-linux/usr/bin/armv5te-oe-linux-gnueabi

OE qemuarm@ ~/build/oe-core $ ls /OE/build/oe-core/tmp-eglibc/sysroots/x86_64-linux/usr/bin/armv5te-oe-linux-gnueabi arm-oe-linux-gnueabi-addr2line arm-oe-linux-gnueabi-elfedit
arm-oe-linux-gnueabi-nm arm-oe-linux-gnueabi-readelf
arm-oe-linux-gnueabi-ar arm-oe-linux-gnueabi-gprof
arm-oe-linux-gnueabi-objcopy arm-oe-linux-gnueabi-size
arm-oe-linux-gnueabi-as arm-oe-linux-gnueabi-ld
arm-oe-linux-gnueabi-objdump arm-oe-linux-gnueabi-strings
arm-oe-linux-gnueabi-c++filt arm-oe-linux-gnueabi-ld.bfd
arm-oe-linux-gnueabi-ranlib arm-oe-linux-gnueabi-strip

but when building eglibc-initial with thumb disalbed, TUNE_PKGARCH becames armv5e and STAGING_BINDIR_TOOLCHAIN in PATH points to wrong dir:

# $STAGING_BINDIR_TOOLCHAIN
# set conf/bitbake.conf:354
# "${STAGING_DIR_NATIVE}${bindir_native}/${TUNE_PKGARCH}${TARGET_VENDOR}-${TARGET_OS}"
STAGING_BINDIR_TOOLCHAIN="/OE/build/oe-core/tmp-eglibc/sysroots/x86_64-linux/usr/bin/armv5e-oe-linux-gnueabi"

OE qemuarm@ ~/build/oe-core $ ls /OE/build/oe-core/tmp-eglibc/sysroots/x86_64-linux/usr/bin/armv5e-oe-linux-gnueabi
ls: cannot access /OE/build/oe-core/tmp-eglibc/sysroots/x86_64-linux/usr/bin/armv5e-oe-linux-gnueabi: No such file or directory

Any idea how to resolve this correctly?

Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]