Skip to content

Compilation error about RISC-V H extension #111637

@KuangjuX

Description

@KuangjuX

I'm trying to use Rust to compile the riscv H extension instructions, but an error occurred during compilation, The Rust target I am using is riscv64gc-unknown-none-elf. When I use rustc --print target-features --target riscv64gc-unknown-none-elf command to check, I found information about the H extension:

    h                             - 'H' (Hypervisor).

Subsequently, I added the following instruction to the compile command:

LOG=debug cargo rustc --release --features "libax/platform-qemu-virt-riscv libax/log-level-debug libax/alloc libax/hv libax/paging libax/irq" --manifest-path=hv/Cargo.toml -- -Ctarget-feature=+h -Clink-arg=-Thvruntime/src/linker.ld -Cforce-frame-pointers=yes 

However, the compilation error remains unresolved:

error: instruction requires the following: 'H' (Hypervisor)
    hsv.b t3, (a0)

What is causing this issue? And my target is specified in .cargo/config.toml and my rustc version is rustc 1.71.0-nightly (2f2c438dc 2023-05-08).

Meta

rustc --version --verbose
rustc 1.71.0-nightly (2f2c438dc 2023-05-08)
binary: rustc
commit-hash: 2f2c438dce75d8cc532c3baa849eeddc0901802c
commit-date: 2023-05-08
host: aarch64-apple-darwin
release: 1.71.0-nightly
LLVM version: 16.0.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.O-riscvTarget: RISC-V architectureT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions