summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorAndrew Jeffery <andrew@aj.id.au>2022-03-01 01:09:46 +1030
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-03-02 18:44:17 +0000
commit102e4c029e30aba78e4045ae06115096870f036f (patch)
tree459526dcbd1c11dd812af3a27664abd59a23f265 /meta
parent39aec4ac7feb9475aa8143bd8854438f10532ab1 (diff)
downloadpoky-102e4c029e30aba78e4045ae06115096870f036f.tar.gz
rust: Introduce arch_to_rust_arch()
On modern Power systems `uname -m` yields 'ppc64le' while the toolchain knows the architecture as 'powerpc64le'. Provide a mapping from one to the other to integrate with the existing architecture configuration flags. arch_to_rust_arch() only exists to map the OE *_ARCH variables before any further processing, unlike arch_to_rust_target_arch() which is specific to the internal triple handling of rust. On Linux ppc64le systems the changes give the following config: ``` $ cat ./tmp/work/ppc64le-linux/rust-native/1.58.0-r0/targets/ppc64le-linux.json { "llvm-target": "powerpc64le-unknown-linux-gnu", "data-layout": "e-m:e-i64:64-n32:64-v256:256:256-v512:512:512", "max-atomic-width": 64, "target-pointer-width": "64", "target-c-int-width": "64", "target-endian": "little", "arch": "powerpc64", "os": "linux", "env": "gnu", "vendor": "unknown", "target-family": "unix", "linker": "gcc", "cpu": "generic", "dynamic-linking": true, "executables": true, "linker-is-gnu": true, "linker-flavor": "gcc", "has-rpath": true, "has-elf-tls": true, "position-independent-executables": true, "panic-strategy": "unwind" } ``` Change-Id: Ief0c01189185d7d4da31d307270bec4e1de674ca (From OE-Core rev: 9ab61e3cfef0157393cb870d606c2f362e190889) Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/base.bbclass2
-rw-r--r--meta/classes/rust-common.bbclass2
-rw-r--r--meta/lib/oe/rust.py5
-rw-r--r--meta/recipes-devtools/rust/rust-common.inc8
4 files changed, 12 insertions, 5 deletions
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index 966eadad67..b7869da3b3 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -12,7 +12,7 @@ inherit logging
12 12
13OE_EXTRA_IMPORTS ?= "" 13OE_EXTRA_IMPORTS ?= ""
14 14
15OE_IMPORTS += "os sys time oe.path oe.utils oe.types oe.package oe.packagegroup oe.sstatesig oe.lsb oe.cachedpath oe.license oe.qa oe.reproducible ${OE_EXTRA_IMPORTS}" 15OE_IMPORTS += "os sys time oe.path oe.utils oe.types oe.package oe.packagegroup oe.sstatesig oe.lsb oe.cachedpath oe.license oe.qa oe.reproducible oe.rust ${OE_EXTRA_IMPORTS}"
16OE_IMPORTS[type] = "list" 16OE_IMPORTS[type] = "list"
17 17
18PACKAGECONFIG_CONFARGS ??= "" 18PACKAGECONFIG_CONFARGS ??= ""
diff --git a/meta/classes/rust-common.bbclass b/meta/classes/rust-common.bbclass
index 98d65970e8..8cfe864ca3 100644
--- a/meta/classes/rust-common.bbclass
+++ b/meta/classes/rust-common.bbclass
@@ -65,7 +65,7 @@ def rust_base_triple(d, thing):
65 if thing == "TARGET" and target_is_armv7(d): 65 if thing == "TARGET" and target_is_armv7(d):
66 arch = "armv7" 66 arch = "armv7"
67 else: 67 else:
68 arch = d.getVar('{}_ARCH'.format(thing)) 68 arch = oe.rust.arch_to_rust_arch(d.getVar('{}_ARCH'.format(thing)))
69 69
70 # All the Yocto targets are Linux and are 'unknown' 70 # All the Yocto targets are Linux and are 'unknown'
71 vendor = "-unknown" 71 vendor = "-unknown"
diff --git a/meta/lib/oe/rust.py b/meta/lib/oe/rust.py
new file mode 100644
index 0000000000..ec70b34805
--- /dev/null
+++ b/meta/lib/oe/rust.py
@@ -0,0 +1,5 @@
1# Handle mismatches between `uname -m`-style output and Rust's arch names
2def arch_to_rust_arch(arch):
3 if arch == "ppc64le":
4 return "powerpc64le"
5 return arch
diff --git a/meta/recipes-devtools/rust/rust-common.inc b/meta/recipes-devtools/rust/rust-common.inc
index ceeee97863..310aecef22 100644
--- a/meta/recipes-devtools/rust/rust-common.inc
+++ b/meta/recipes-devtools/rust/rust-common.inc
@@ -313,10 +313,12 @@ def rust_gen_target(d, thing, wd, features, cpu, arch, abi=""):
313 sys = sys_for(d, thing) 313 sys = sys_for(d, thing)
314 prefix = prefix_for(d, thing) 314 prefix = prefix_for(d, thing)
315 315
316 rust_arch = oe.rust.arch_to_rust_arch(arch)
317
316 if abi: 318 if abi:
317 arch_abi = "{}-{}".format(arch, abi) 319 arch_abi = "{}-{}".format(rust_arch, abi)
318 else: 320 else:
319 arch_abi = arch 321 arch_abi = rust_arch
320 322
321 features = features or d.getVarFlag('FEATURES', arch_abi) or "" 323 features = features or d.getVarFlag('FEATURES', arch_abi) or ""
322 features = features.strip() 324 features = features.strip()
@@ -329,7 +331,7 @@ def rust_gen_target(d, thing, wd, features, cpu, arch, abi=""):
329 tspec['target-pointer-width'] = d.getVarFlag('TARGET_POINTER_WIDTH', arch_abi) 331 tspec['target-pointer-width'] = d.getVarFlag('TARGET_POINTER_WIDTH', arch_abi)
330 tspec['target-c-int-width'] = d.getVarFlag('TARGET_C_INT_WIDTH', arch_abi) 332 tspec['target-c-int-width'] = d.getVarFlag('TARGET_C_INT_WIDTH', arch_abi)
331 tspec['target-endian'] = d.getVarFlag('TARGET_ENDIAN', arch_abi) 333 tspec['target-endian'] = d.getVarFlag('TARGET_ENDIAN', arch_abi)
332 tspec['arch'] = arch_to_rust_target_arch(arch) 334 tspec['arch'] = arch_to_rust_target_arch(rust_arch)
333 tspec['os'] = "linux" 335 tspec['os'] = "linux"
334 if "musl" in tspec['llvm-target']: 336 if "musl" in tspec['llvm-target']:
335 tspec['env'] = "musl" 337 tspec['env'] = "musl"