Compile error on RISC-V due to .insn (llvm<=13 only)
XieJiSS opened this issue · 4 comments
I'd like to create this issue to track the status of compiling .insn i 0x0F, 0, x0, x0, 0x010
directives, as well as pause
/ fence w,0
(these three are aliases)
Currently with clang 13.0.1, this error occurs when compiling rust:
error: unknown directive
|
note: instantiated into assembly here
--> <inline asm>:1:2
|
1 | .insn i 0x0F, 0, x0, x0, 0x010
| ^
error: could not compile `log` due to previous error
This is introduced by 597b8e8. I'm not saying that the commit itself has issues: rust can use this safely because rust-lang/llvm-project
has cherry-picked the upstream commit to support .insn
: rust-lang/rust#91528. However, for those using clang v13.0.1 (or, let's say, the unmodified llvm toolchain), they may encounter this issue during compiling. Hence, I create this issue as a explanation as well as tracking the status of llvm support for .insn
.
The code should compile fine with clang 14.
In my opinion, the problem is that we are using this feature too early, I'm not saying it's wrong to use a new feature, but since almost downstream and users use rust with vanilla LLVM, we should use this feature when LLVM 14 is released.
A new tag waiting-llvm-release
can be added to some pull requests that use unreleased LLVM features, we should check them out when LLVM releases a new major version instead of merging it right away.
In general the functions in std::arch
are only fully supported when using Rust's custom LLVM fork. Normally this isn't a problem unless you specifically use these intrinsics in user code.
However in this case I would accept a PR to change this to a .word
or equivalent since this is preventing Rust itself from compiling.
The mainstream LLVM has released LLVM 14: https://github.com/llvm/llvm-project/releases/tag/llvmorg-14.0.0 .
Thanks, I'm closing this issue as LLVM 14 can compile rust now