Skip to content
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

Compile error on RISC-V due to .insn (llvm<=13 only) #1291

Closed
XieJiSS opened this issue Mar 11, 2022 · 4 comments
Closed

Compile error on RISC-V due to .insn (llvm<=13 only) #1291

XieJiSS opened this issue Mar 11, 2022 · 4 comments

Comments

@XieJiSS
Copy link

XieJiSS commented Mar 11, 2022

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.

@CoelacanthusHex
Copy link

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.

@Amanieu
Copy link
Member

Amanieu commented Mar 11, 2022

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.

@luojia65
Copy link
Contributor

The mainstream LLVM has released LLVM 14: https://github.com/llvm/llvm-project/releases/tag/llvmorg-14.0.0 .

@XieJiSS
Copy link
Author

XieJiSS commented Mar 30, 2022

Thanks, I'm closing this issue as LLVM 14 can compile rust now

@XieJiSS XieJiSS closed this as completed Mar 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants