-
Notifications
You must be signed in to change notification settings - Fork 718
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RISC-V has different triples for clang and rustc. #2136
Comments
Fixed by #2137 |
trissylegs
changed the title
RISC-V has different triples for clang and risc-v.
RISC-V has different triples for clang and rustc.
Feb 26, 2022
This is also a problem for |
TheConner
added a commit
to TheConner/rust-bindgen
that referenced
this issue
Jun 10, 2023
Similar problem as the one mentioned in rust-lang#2136, just continuing by adding the 32 bit risc tuple mappings. Tuples like riscv32imc- should map to the clang riscv32- tuple. Fixed by adding mappings and tests for the mappings.
TheConner
added a commit
to TheConner/rust-bindgen
that referenced
this issue
Jun 10, 2023
Similar problem as the one mentioned in rust-lang#2136, just continuing by adding the 32 bit risc tuple mappings. Tuples like riscv32imc- and riscv32imac- should map to the clang riscv32- tuple. Fixed by adding mappings and tests for the mappings. Projects that now failed to build the "riscv32imac-unknown-none-elf" target tuple now build without issue.
TheConner
added a commit
to TheConner/rust-bindgen
that referenced
this issue
Jun 10, 2023
Similar problem as the one mentioned in rust-lang#2136, just continuing by adding the 32 bit risc tuple mappings. Tuples like riscv32imc- and riscv32imac- should map to the clang riscv32- tuple. Fixed by adding mappings and tests for the mappings. Projects that now failed to build the "riscv32imac-unknown-none-elf" target tuple now build without issue.
pvdrz
pushed a commit
that referenced
this issue
Jun 10, 2023
Similar problem as the one mentioned in #2136, just continuing by adding the 32 bit risc tuple mappings. Tuples like riscv32imc- and riscv32imac- should map to the clang riscv32- tuple. Fixed by adding mappings and tests for the mappings. Projects that now failed to build the "riscv32imac-unknown-none-elf" target tuple now build without issue.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Same as #1211 Clang and rust use a different target triples on riscv.
I'm already trying to fix it. Using a similar solution to #1211. (I found the issue due to a comment on
rust_to_clang_target
)Rust uses
riscv64gc-unknown-linux-gnu
, but clang usesriscv64-unknown-linux-gnu
.The difference is that
riscv64gc
has the extra features needed to run Linux. (ie Mutiplication, Floats, Atomics, Fences and CSRs), as well as Compressed instructions (16-bit encodings).Clang instead uses
-march
to specify which extensions to use: eg (-march=rv6gc
). Maybe should consider setting that too.The example below is taken from authenticator-rs: https://github.com/mozilla/authenticator-rs/blob/660a701b45977cb5d184380061dfc8cec4f696be/build.rs#L12
Input C/C++ Header
// Literally anything
Bindgen Invocation
Actual Results
Expected Results
Expected results are that bindgen uses clang with the matching target triple.
Workarond
Specify
.clang_arg("--target=riscv64-unknown-linux-gnu")
on riscvEg: https://github.com/trissylegs/authenticator-rs/blob/abcf07a231667e16a50da855d3e86765c158f0a2/build.rs#L19
The text was updated successfully, but these errors were encountered: