@@ -19,6 +19,26 @@ macro_rules! cfg_global_asm {
19
19
} ;
20
20
}
21
21
22
+ // Provisional patch to avoid LLVM spurious errors when compiling in release mode.
23
+ // This patch is somewhat hardcoded and relies on the fact that the rustc compiler
24
+ // only supports a limited combination of ISA extensions. This patch should be
25
+ // removed when LLVM fixes the issue. Alternatively, it must be updated when rustc
26
+ // supports more ISA extension combinations.
27
+ //
28
+ // Related issues:
29
+ // - https://github.com/rust-embedded/riscv/issues/175
30
+ // - https://github.com/rust-lang/rust/issues/80608
31
+ // - https://github.com/llvm/llvm-project/issues/61991
32
+ cfg_global_asm ! (
33
+ "// Provisional patch to avoid LLVM spurious errors when compiling in release mode." ,
34
+ #[ cfg( all( riscv32, riscvm) ) ]
35
+ ".attribute arch, \" rv32im\" " ,
36
+ #[ cfg( all( riscv64, riscvm, not( riscvg) ) ) ]
37
+ ".attribute arch, \" rv64im\" " ,
38
+ #[ cfg( all( riscv64, riscvg) ) ]
39
+ ".attribute arch, \" rv64g\" " ,
40
+ ) ;
41
+
22
42
// Entry point of all programs (_start). It initializes DWARF call frame information,
23
43
// the stack pointer, the frame pointer (needed for closures to work in start_rust)
24
44
// and the global pointer. Then it calls _start_rust.
0 commit comments