summaryrefslogtreecommitdiffstats
path: root/meta/classes-recipe/rust-target-config.bbclass
diff options
context:
space:
mode:
authorAlejandro Hernandez Samaniego <alejandro@enedino.org>2022-12-15 00:32:24 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-12-21 10:16:31 +0000
commit901f7ed6ba76cb97d149b6481dfb73887790c55b (patch)
tree21654505d01210e334f1f668cff636929b76ee60 /meta/classes-recipe/rust-target-config.bbclass
parentcb33d63060eee74823482de07c1c50a4933ab8f1 (diff)
downloadpoky-901f7ed6ba76cb97d149b6481dfb73887790c55b.tar.gz
rust: Enable baremetal targets
Allow rust to build for baremetal targets by generating the proper target triple, follow the format specified by rusts Triple [1], that is: <arch>-<vendor>-<os>-<abi> This is done automatically based on both TARGET_OS and TCLIBC. For example, a riscv64 baremetal target triple would look like this: riscv64gc-poky-none-elf matching rusts own target triple for riscv64 according to platform-support [2] [1] https://docs.rs/target-lexicon/latest/target_lexicon/struct.Triple.html [2] https://doc.rust-lang.org/stable/rustc/platform-support.html (From OE-Core rev: 3bff689f0c5ea73076ce0510872b0552e8660cbe) Signed-off-by: Alejandro Enedino Hernandez Samaniego <alejandro@enedino.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes-recipe/rust-target-config.bbclass')
-rw-r--r--meta/classes-recipe/rust-target-config.bbclass5
1 files changed, 4 insertions, 1 deletions
diff --git a/meta/classes-recipe/rust-target-config.bbclass b/meta/classes-recipe/rust-target-config.bbclass
index 2710b4325d..7fd7128bcf 100644
--- a/meta/classes-recipe/rust-target-config.bbclass
+++ b/meta/classes-recipe/rust-target-config.bbclass
@@ -355,7 +355,10 @@ def rust_gen_target(d, thing, wd, arch):
355 tspec['target-c-int-width'] = d.getVarFlag('TARGET_C_INT_WIDTH', arch_abi) 355 tspec['target-c-int-width'] = d.getVarFlag('TARGET_C_INT_WIDTH', arch_abi)
356 tspec['target-endian'] = d.getVarFlag('TARGET_ENDIAN', arch_abi) 356 tspec['target-endian'] = d.getVarFlag('TARGET_ENDIAN', arch_abi)
357 tspec['arch'] = arch_to_rust_target_arch(rust_arch) 357 tspec['arch'] = arch_to_rust_target_arch(rust_arch)
358 tspec['os'] = "linux" 358 if "baremetal" in d.getVar('TCLIBC'):
359 tspec['os'] = "none"
360 else:
361 tspec['os'] = "linux"
359 if "musl" in tspec['llvm-target']: 362 if "musl" in tspec['llvm-target']:
360 tspec['env'] = "musl" 363 tspec['env'] = "musl"
361 else: 364 else: