* [PATCH 2/4] rust-cross-canadian: Fix ordering of target json config generation
2022-07-23 11:10 [PATCH 1/4] rust-common: Set llvm-target correctly for cross SDK targets Richard Purdie
@ 2022-07-23 11:10 ` Richard Purdie
2022-07-23 11:10 ` [PATCH 3/4] rust-cross/rust-common: Merge arm target handling code to fix cross-canadian Richard Purdie
2022-07-23 11:10 ` [PATCH 4/4] rust-cross: Simplfy the rust_gen_target calls Richard Purdie
2 siblings, 0 replies; 4+ messages in thread
From: Richard Purdie @ 2022-07-23 11:10 UTC (permalink / raw)
To: openembedded-core
Based upon a patch from Otavio Salvador <otavio@ossystems.com.br>,
ensure the target json files are written in the correct order with
the most specific last incase it overwrites earlier files if the prefixes
match.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
meta/recipes-devtools/rust/rust-cross-canadian-common.inc | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/meta/recipes-devtools/rust/rust-cross-canadian-common.inc b/meta/recipes-devtools/rust/rust-cross-canadian-common.inc
index 1f21c8af26e..df4901f1fac 100644
--- a/meta/recipes-devtools/rust/rust-cross-canadian-common.inc
+++ b/meta/recipes-devtools/rust/rust-cross-canadian-common.inc
@@ -27,9 +27,10 @@ DEBUG_PREFIX_MAP = "-fdebug-prefix-map=${WORKDIR}=/usr/src/debug/${PN}/${EXTENDP
python do_rust_gen_targets () {
wd = d.getVar('WORKDIR') + '/targets/'
- rust_gen_target(d, 'TARGET', wd, d.getVar('TARGET_LLVM_FEATURES') or "", d.getVar('TARGET_LLVM_CPU'), d.getVar('TARGET_ARCH'))
- rust_gen_target(d, 'HOST', wd, "", "generic", d.getVar('HOST_ARCH'))
+ # Order of BUILD, HOST, TARGET is important in case the files overwrite, most specific last
rust_gen_target(d, 'BUILD', wd, "", "generic", d.getVar('BUILD_ARCH'))
+ rust_gen_target(d, 'HOST', wd, "", "generic", d.getVar('HOST_ARCH'))
+ rust_gen_target(d, 'TARGET', wd, d.getVar('TARGET_LLVM_FEATURES') or "", d.getVar('TARGET_LLVM_CPU'), d.getVar('TARGET_ARCH'))
}
INHIBIT_DEFAULT_RUST_DEPS = "1"
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/4] rust-cross/rust-common: Merge arm target handling code to fix cross-canadian
2022-07-23 11:10 [PATCH 1/4] rust-common: Set llvm-target correctly for cross SDK targets Richard Purdie
2022-07-23 11:10 ` [PATCH 2/4] rust-cross-canadian: Fix ordering of target json config generation Richard Purdie
@ 2022-07-23 11:10 ` Richard Purdie
2022-07-23 11:10 ` [PATCH 4/4] rust-cross: Simplfy the rust_gen_target calls Richard Purdie
2 siblings, 0 replies; 4+ messages in thread
From: Richard Purdie @ 2022-07-23 11:10 UTC (permalink / raw)
To: openembedded-core
rust-cross had special handling for armv7 targets but we also need this
for cross-canadian. Merge the code into the main function so everything is
consistent.
Also then fix the arm definition to be arm-eabi since ABI is correctly
being looked up.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
meta/recipes-devtools/rust/rust-common.inc | 6 ++++++
meta/recipes-devtools/rust/rust-cross.inc | 7 +------
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/meta/recipes-devtools/rust/rust-common.inc b/meta/recipes-devtools/rust/rust-common.inc
index 37abd2cd26d..82ff03b9089 100644
--- a/meta/recipes-devtools/rust/rust-common.inc
+++ b/meta/recipes-devtools/rust/rust-common.inc
@@ -297,6 +297,12 @@ def rust_gen_target(d, thing, wd, features, cpu, arch, abi=""):
sys = sys_for(d, thing)
prefix = prefix_for(d, thing)
+ if thing == "TARGET":
+ abi = d.getVar('ABIEXTENSION')
+ # arm and armv7 have different targets in llvm
+ if arch == "arm" and target_is_armv7(d):
+ arch = 'armv7'
+
rust_arch = oe.rust.arch_to_rust_arch(arch)
if abi:
diff --git a/meta/recipes-devtools/rust/rust-cross.inc b/meta/recipes-devtools/rust/rust-cross.inc
index f6babfeedaa..4c026b1f388 100644
--- a/meta/recipes-devtools/rust/rust-cross.inc
+++ b/meta/recipes-devtools/rust/rust-cross.inc
@@ -8,15 +8,10 @@ python do_rust_gen_targets () {
features = ""
cpu = "generic"
arch = d.getVar('{}_ARCH'.format(thing))
- abi = ""
if thing is "TARGET":
- abi = d.getVar('ABIEXTENSION')
- # arm and armv7 have different targets in llvm
- if arch == "arm" and target_is_armv7(d):
- arch = 'armv7'
features = d.getVar('TARGET_LLVM_FEATURES') or ""
cpu = d.getVar('TARGET_LLVM_CPU')
- rust_gen_target(d, thing, wd, features, cpu, arch, abi)
+ rust_gen_target(d, thing, wd, features, cpu, arch)
}
# Otherwise we'll depend on what we provide
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 4/4] rust-cross: Simplfy the rust_gen_target calls
2022-07-23 11:10 [PATCH 1/4] rust-common: Set llvm-target correctly for cross SDK targets Richard Purdie
2022-07-23 11:10 ` [PATCH 2/4] rust-cross-canadian: Fix ordering of target json config generation Richard Purdie
2022-07-23 11:10 ` [PATCH 3/4] rust-cross/rust-common: Merge arm target handling code to fix cross-canadian Richard Purdie
@ 2022-07-23 11:10 ` Richard Purdie
2 siblings, 0 replies; 4+ messages in thread
From: Richard Purdie @ 2022-07-23 11:10 UTC (permalink / raw)
To: openembedded-core
Match the code in rust-cross-canadian so that further simplifications
can be considered in future.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
meta/recipes-devtools/rust/rust-common.inc | 12 ++++++------
meta/recipes-devtools/rust/rust-cross.inc | 16 ++++------------
2 files changed, 10 insertions(+), 18 deletions(-)
diff --git a/meta/recipes-devtools/rust/rust-common.inc b/meta/recipes-devtools/rust/rust-common.inc
index 82ff03b9089..d00b380dbde 100644
--- a/meta/recipes-devtools/rust/rust-common.inc
+++ b/meta/recipes-devtools/rust/rust-common.inc
@@ -119,12 +119,12 @@ def llvm_features(d):
## arm-unknown-linux-gnueabihf
-DATA_LAYOUT[arm] = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
-TARGET_ENDIAN[arm] = "little"
-TARGET_POINTER_WIDTH[arm] = "32"
-TARGET_C_INT_WIDTH[arm] = "32"
-MAX_ATOMIC_WIDTH[arm] = "64"
-FEATURES[arm] = "+v6,+vfp2"
+DATA_LAYOUT[arm-eabi] = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
+TARGET_ENDIAN[arm-eabi] = "little"
+TARGET_POINTER_WIDTH[arm-eabi] = "32"
+TARGET_C_INT_WIDTH[arm-eabi] = "32"
+MAX_ATOMIC_WIDTH[arm-eabi] = "64"
+FEATURES[arm-eabi] = "+v6,+vfp2"
## armv7-unknown-linux-gnueabihf
DATA_LAYOUT[armv7-eabi] = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
diff --git a/meta/recipes-devtools/rust/rust-cross.inc b/meta/recipes-devtools/rust/rust-cross.inc
index 4c026b1f388..2e47a3aa5f3 100644
--- a/meta/recipes-devtools/rust/rust-cross.inc
+++ b/meta/recipes-devtools/rust/rust-cross.inc
@@ -1,17 +1,9 @@
python do_rust_gen_targets () {
wd = d.getVar('WORKDIR') + '/targets/'
- # It is important 'TARGET' is last here so that it overrides our less
- # informed choices for BUILD & HOST if TARGET happens to be the same as
- # either of them.
- for thing in ['BUILD', 'HOST', 'TARGET']:
- bb.debug(1, "rust_gen_target for " + thing)
- features = ""
- cpu = "generic"
- arch = d.getVar('{}_ARCH'.format(thing))
- if thing is "TARGET":
- features = d.getVar('TARGET_LLVM_FEATURES') or ""
- cpu = d.getVar('TARGET_LLVM_CPU')
- rust_gen_target(d, thing, wd, features, cpu, arch)
+ # Order of BUILD, HOST, TARGET is important in case the files overwrite, most specific last
+ rust_gen_target(d, 'BUILD', wd, "", "generic", d.getVar('BUILD_ARCH'))
+ rust_gen_target(d, 'HOST', wd, "", "generic", d.getVar('HOST_ARCH'))
+ rust_gen_target(d, 'TARGET', wd, d.getVar('TARGET_LLVM_FEATURES') or "", d.getVar('TARGET_LLVM_CPU'), d.getVar('TARGET_ARCH'))
}
# Otherwise we'll depend on what we provide
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread