summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/rust/rust-common.inc
AgeCommit message (Collapse)Author
2022-07-23rust-common/rust-cross: Clean up target json generation coderpurdie/debugsymbolsRichard Purdie
Some of the subtleties in the different codepaths for target rust json generation were not easy to spot. Start to simplfy the code to make this clearer. This patch should not have any functionality change. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-07-23rust-cross: Simplfy the rust_gen_target callsRichard Purdie
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>
2022-07-23rust-cross/rust-common: Merge arm target handling code to fix cross-canadianRichard Purdie
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>
2022-07-23rust-common: Set llvm-target correctly for cross SDK targetsRichard Purdie
When a 'BUILD' target is requested we shouldn't be looking at TARGET_SYS but at BUILD_SYS. Due to the way rust mangles triplets, we need the HOST_SYS triplet to work with existing code - fixing that issue is a separate patch. Also drop the arch_abi argument, it doens't make any sense to a getVar() call and was a copy and paste error. Based on a patch from Otavio Salvador <otavio@ossystems.com.br> but separated out and tweaked. Fixes: bd36593ba3 ("rust-common: Drop LLVM_TARGET and simplify") Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-06-29rust: fix issue building cross-canadian tools for aarch64 on x86_64Peter Bergin
Commit bd36593ba3db758b3eacc974e48468a665967961 did introduce a regression when building package rust-cross-canadian-aarch64 on a x86_64 host. This commit will fix that configuration. Suggested-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Peter Bergin <peter@berginkonsult.se> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-05-21rust-common: Fix native signature dependency issuesRichard Purdie
The previous changes cause sstatetests.SStateTests.test_sstate_32_64_same_hash to fail since RUST_XXX_SYS changes depending on the native architecture. This is correct but these are accounted for in the layout of paths in TMPDIR so they should be excluded from the task signatures for the correct behaviour. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-05-21rust-common: Drop LLVM_TARGET and simplifyRichard Purdie
This all seems over complicated for something which is basically always one of two values. This might even help cross-canadian work on something which isn't x86-64. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-05-21rust-common: Fix for target definitions returning 'NoneType' for armSundeep KOKKONDA
[YOCTO #14742] The build shows below error while building for arm machines. Exception: TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType' Detailed error info : Steps to reproduce: 1. Set MACHINE ?= "qemuarm" in local.conf & add 'TOOLCHAIN_HOST_TASK:append = " packagegroup-rust-cross-canadian-${MACHINE}"' 2. bitbake core-image-minimal -cpopulate_sdk Complete Error: ERROR: rust-cross-canadian-arm-1.59.0-r0 do_rust_gen_targets: Error executing a python function in exec_func_python() autogenerated: The stack trace of python calls that resulted in this exception/failure was: File: 'exec_func_python() autogenerated', lineno: 2, function: <module> 0001: *** 0002:do_rust_gen_targets(d) 0003: File: '/ala-lpggp31/skokkonda/yocto/poky/meta/recipes-devtools/rust/rust-cross-canadian-common.inc', lineno: 31, function: do_rust_gen_targets 0027: 0028:LLVM_TARGET[x86_64] = "${RUST_HOST_SYS}" 0029:python do_rust_gen_targets () { 0030: wd = d.getVar('WORKDIR') + '/targets/' *** 0031: rust_gen_target(d, 'TARGET', wd, d.getVar('TARGET_LLVM_FEATURES') or "", d.getVar('TARGET_LLVM_CPU'), d.getVar('TARGET_ARCH')) 0032: rust_gen_target(d, 'HOST', wd, "", "generic", d.getVar('HOST_ARCH')) 0033: rust_gen_target(d, 'BUILD', wd, "", "generic", d.getVar('BUILD_ARCH')) 0034:} 0035: File: '/ala-lpggp31/skokkonda/yocto/poky/meta/recipes-devtools/rust/rust-common.inc', lineno: 330, function: rust_gen_target 0326: # build tspec 0327: tspec = {} 0328: tspec['llvm-target'] = d.getVarFlag('LLVM_TARGET', arch_abi) 0329: tspec['data-layout'] = d.getVarFlag('DATA_LAYOUT', arch_abi) *** 0330: tspec['max-atomic-width'] = int(d.getVarFlag('MAX_ATOMIC_WIDTH', arch_abi)) 0331: tspec['target-pointer-width'] = d.getVarFlag('TARGET_POINTER_WIDTH', arch_abi) 0332: tspec['target-c-int-width'] = d.getVarFlag('TARGET_C_INT_WIDTH', arch_abi) 0333: tspec['target-endian'] = d.getVarFlag('TARGET_ENDIAN', arch_abi) 0334: tspec['arch'] = arch_to_rust_target_arch(rust_arch) Exception: TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType' Below are the local variables from rust_gen_target function for arm and aarch64 targets. Refer below, the tspec varibles for 'arm' generated with NoneType. (a) Locals at rust_gen_target for arm:: tspec['data-layout'] = None, Type of tspec['data-layout'] = <class 'NoneType'> tspec['data-layout'] = None, Type of tspec['data-layout'] = <class 'NoneType'> DEBUG: Python function do_rust_gen_targets finished (b) Locals at rust_gen_target for aarch64:: tspec['data-layout'] = aarch64-unknown-linux-gnu, Type of tspec['data-layout'] = <class 'str'> tspec['max-atomic-width'] = 128, Type of tspec['max-atomic-width'] = <class 'int'> Reason for changing arm-eabi to arm: The earlier changes introduced this bug, so reverting the change 'arm-eabi' to 'arm' fixed the issue. Signed-off-by: Sundeep KOKKONDA <sundeep.kokkonda@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-05-21rust-common: Ensure sstate signatures have correct dependencues for ↵Sundeep KOKKONDA
do_rust_gen_targets The do_rust_gen_targets task was not rerunning when the configuration variables it uses were changed. Add the missing variable dependencies to fix this. [RP: Split to separate patch and add commit message] Signed-off-by: Sundeep KOKKONDA <sundeep.kokkonda@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-04-05Revert "meta: rust: Bug fix for target definitions returning 'NoneType'"Richard Purdie
This reverts commit ef49f89c89889466ee3696ab680f8e10c961a677. This appears to cause build failures which didn't originally show up in testing, reverting for now.
2022-04-05meta: rust: Bug fix for target definitions returning 'NoneType'Sundeep KOKKONDA
The build shows below error while building for arm machines. Exception: TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType' Detailed error info : https://lists.openembedded.org/g/openembedded-core/message/164004 All the target definitions within tspec dictionary are generted as NoneType. The changes will fix this issue. Signed-off-by: Sundeep KOKKONDA <sundeep.kokkonda@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-03-02rust: Introduce arch_to_rust_arch()Andrew Jeffery
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 Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-10-27rust: add support for big endian 64-bit PowerPCDavid Joyner
Signed-off-by: David Joyner <dbjoyner@amazon.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-10-14rust: generate target definitions from (arch, abi), not just archAlexander Kanavin
This allows to add the missing x32 definition and others in the future. Signed-off-by: Alexander Kanavin <alex@linutronix.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-10-14rust: do not write ar into target json definitionsAlexander Kanavin
latest rust does not use it and prints a ton of warnings because of it. Signed-off-by: Alexander Kanavin <alex@linutronix.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-08-26rust-cross*: Fix OVERRRIDE references in task signature computationRichard Purdie
The oeqa selftest test: sstatetests.SStateTests.test_sstate_sametune_samesigs which checks if the sstate checksums of two identical machines (using the same tune) are the same, apart from changes within the machine specific stamps directory, fails on the assertion: self.assertCountEqual(files1, files2) due to the signature of various 32 bit package builds such as: x86_64-linux/lib32-rust-cross-i686 x86_64-linux/rust-cross-i686 x86-pokymllib32-linux/lib32-libstd-rs x86-pokymllib32-linux/lib32-rust differing. Jumping down the rabbit hole past all the bitbake-diffsig outputs that differ due to dependent hashes, you come to a diff of: -Variable MACHINEOVERRIDES value is ${@bb.utils.contains('TUNE_FEATURES', 'mx32', 'x86-x32:', '', d)}${@bb.utils.contains('TUNE_FEATURES', 'm32', 'x86:', '', d)}qemuall:${MACHINE} +Variable MACHINEOVERRIDES value is ${@bb.utils.contains('TUNE_FEATURES', 'mx32', 'x86-x32:', '', d)}${@bb.utils.contains('TUNE_FEATURES', 'm32', 'x86:', '', d)}qemuall:${MACHINE}:qemux86 in stamps/x86_64-linux/rust-cross-i686/1.54.0-r0.do_rust_gen_target.<sig> This is because there are two rust functions referencing OVERRIDES related variables (target_is_armv7 and llvm_features_from_tune). These indirectly influnce the build and should be excluded from the signatures directly as is done in other toolchain recipes, e.g.: 39bfa0dd32 recipes/*-cross recipes: ignore TARGET_ARCH sstate hash Signed-off-by: Randy MacLeod <Randy.MacLeod@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-08-26rust-common.inc: Fix build failure with qemuppc64.Vinay Kumar
The glibc build of "rust-hello-world" throws error in libstd-rs package. error: unrecognized arch "powerpc64le" in target specification The same got fixed by changing the arch to "powerpc64". Signed-off-by: Vinay Kumar <vinay.m.engg@gmail.com> Signed-off-by: Randy MacLeod <Randy.MacLeod@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-08-26rust: initial merge of most of meta-rustRandy MacLeod
In the meta-rust repo at commit: 448047c Upgrade to 1.54.0 (#359) Make the required directories: mkdir ../oe-core/meta/recipes-devtools/rust mkdir ../oe-core/meta/recipes-devtools/cargo mkdir ../oe-core/meta/recipes-example and then: cp recipes-devtools/rust/* ../oe-core/meta/recipes-devtools/rust cp recipes-devtools/cargo/* ../oe-core/meta/recipes-devtools/cargo cp lib/crate.py ../oe-core/meta/lib cp recipes-example/* ../oe-core/meta/recipes-example cp conf/distro/include/rust_* ../oe-core/meta/conf/distro/include/ cp classes/* ../oe-core/meta/classes/ cp recipes-core/packagegroups/packagegroup-rust-cross-canadian.bb ../oe-core/meta/recipes-core/packagegroups Signed-off-by: Randy MacLeod <Randy.MacLeod@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>