Skip to content

core crate build fails for mips16 instruction set #62612

Open
@athei

Description

@athei

I am writing bare metal code for a mipsel cpu. Since there is no readily available target for hat in rustc I use cargo xbuild to build one from a target specification that I derived from the mipsel linux target. This works great and the resulting code runs on the CPU. The CPU I am using supports mips16 ISA to improve code density. However, when I enable the feature in my target spec I get the follwing error when compiling the core crate:

LLVM ERROR: Not supported instr: <MCInst 351 <MCOperand Reg:321> <MCOperand Imm:2147483647> <MCOperand Imm:-1>>
error: Could not compile `core`.

To learn more, run the command again with --verbose.
error: `"/Users/alexander/.rustup/toolchains/nightly-x86_64-apple-darwin/bin/cargo" "rustc" "-p" "alloc" "--release" "--manifest-path" "/var/folders/8g/_rkmq65n0qnf70c41xvp174h0000gn/T/xargo.cfTitdX9TS2Q/Cargo.toml" "--target" "mipsel-unknown-none" "--" "-Z" "force-unstable-if-unmarked"` failed with exit code: Some(101)
make: *** [target/mipsel-unknown-none/release/mipswififw] Error 1

This is my spec:

{
  "llvm-target": "mipsel-unknown-none",
  "arch": "mips",
  "cpu": "mips32r2",
  "data-layout": "e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64",
  "executables": true,
  "features": "+mips32r2,+mips16,+soft-float",
  "linker-flavor": "ld.lld",
  "linker": "rust-lld",
  "panic-strategy": "abort",
  "max-atomic-width": 32,
  "os": "none",
  "target-c-int-width": "32",
  "target-endian": "little",
  "target-pointer-width": "32"
}

When I remove the mips16 feature the error is gone.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-bugCategory: This is a bug.O-MIPSTarget: MIPS processorsT-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