Closed
Description
When trying to compile the gba
crate(gba = { git = "https://github.com/rust-console/gba", rev = "127f31e" }
) using the following target:
{
"abi-blacklist": [
"stdcall",
"fastcall",
"vectorcall",
"thiscall",
"win64",
"sysv64"
],
"arch": "arm",
"atomic-cas": false,
"cpu": "arm7tdmi",
"data-layout": "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64",
"emit-debug-gdb-scripts": false,
"env": "agb",
"executables": true,
"features": "+soft-float,+strict-align",
"linker": "arm-none-eabi-ld",
"linker-flavor": "ld",
"linker-is-gnu": true,
"llvm-target": "thumbv4-none-agb",
"os": "none",
"panic-strategy": "abort",
"pre-link-args-crt": {
"ld": [
"crt0.o"
]
},
"pre-link-args": {
"ld": [
"-Tlinker.ld"
]
},
"relocation-model": "static",
"target-c-int-width": "32",
"target-endian": "little",
"target-pointer-width": "32",
"vendor": "nintendo"
}
I get this compiler error:
error: invalid register `r9`: r9 is used internally by LLVM and cannot be used as an operand for inline asm
--> C:\Users\anon\.cargo\git\checkouts\gba-4ba04b9d61fb788f\127f31e\src\sync\statics.rs:106:72
|
106 | out("r2") _, out("r3") _, out("r4") _, out("r5") _, out("r8") _, out("r9") _,
| ^^^^^^^^^^^
error: invalid register `r9`: r9 is used internally by LLVM and cannot be used as an operand for inline asm
--> C:\Users\anon\.cargo\git\checkouts\gba-4ba04b9d61fb788f\127f31e\src\sync\statics.rs:113:72
|
113 | out("r2") _, out("r3") _, out("r4") _, out("r5") _, out("r8") _, out("r9") _,
| ^^^^^^^^^^^
error: invalid register `r9`: r9 is used internally by LLVM and cannot be used as an operand for inline asm
--> C:\Users\anon\.cargo\git\checkouts\gba-4ba04b9d61fb788f\127f31e\src\sync\statics.rs:121:72
|
121 | out("r2") _, out("r3") _, out("r4") _, out("r5") _, out("r8") _, out("r9") _,
| ^^^^^^^^^^^
error: invalid register `r9`: r9 is used internally by LLVM and cannot be used as an operand for inline asm
--> C:\Users\anon\.cargo\git\checkouts\gba-4ba04b9d61fb788f\127f31e\src\sync\statics.rs:129:72
|
129 | out("r2") _, out("r3") _, out("r4") _, out("r5") _, out("r8") _, out("r9") _,
| ^^^^^^^^^^^
error: aborting due to 4 previous errors
error: could not compile `gba`
This seems to be a bug in the asm!
macro as this code used to compile just fine.
I'm using the latest nightly rustc release:
$ rustc --version --verbose
rustc 1.54.0-nightly (79e50bf77 2021-05-10)
binary: rustc
commit-hash: 79e50bf77928f374921a6bcafee3fcff1915f062
commit-date: 2021-05-10
host: x86_64-pc-windows-msvc
release: 1.54.0-nightly
LLVM version: 12.0.1
The same thing also happens when using the gnu toolchain:
$ rustc --version --verbose
rustc 1.54.0-nightly (79e50bf77 2021-05-10)
binary: rustc
commit-hash: 79e50bf77928f374921a6bcafee3fcff1915f062
commit-date: 2021-05-10
host: x86_64-pc-windows-gnu
release: 1.54.0-nightly
LLVM version: 12.0.1