diff options
author | Alejandro Hernandez Samaniego <alejandro@enedino.org> | 2022-12-15 00:32:24 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-12-21 10:16:31 +0000 |
commit | 901f7ed6ba76cb97d149b6481dfb73887790c55b (patch) | |
tree | 21654505d01210e334f1f668cff636929b76ee60 /meta/classes-recipe/rust-common.bbclass | |
parent | cb33d63060eee74823482de07c1c50a4933ab8f1 (diff) | |
download | poky-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-common.bbclass')
-rw-r--r-- | meta/classes-recipe/rust-common.bbclass | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/meta/classes-recipe/rust-common.bbclass b/meta/classes-recipe/rust-common.bbclass index 3338de7502..0f72e45e8c 100644 --- a/meta/classes-recipe/rust-common.bbclass +++ b/meta/classes-recipe/rust-common.bbclass | |||
@@ -66,6 +66,12 @@ def rust_base_triple(d, thing): | |||
66 | elif "musl" in os: | 66 | elif "musl" in os: |
67 | libc = "-musl" | 67 | libc = "-musl" |
68 | os = "linux" | 68 | os = "linux" |
69 | elif "elf" in os: | ||
70 | libc = "-elf" | ||
71 | os = "none" | ||
72 | elif "eabi" in os: | ||
73 | libc = "-eabi" | ||
74 | os = "none" | ||
69 | 75 | ||
70 | return arch + vendor + '-' + os + libc | 76 | return arch + vendor + '-' + os + libc |
71 | 77 | ||