mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-14 18:36:35 +00:00
[libunwind][RISCV] Make asm statement volatile (#130286)
Compiling with `O3`, the `early-machinelicm` pass hoisted the asm statement to a path that has been executed unconditionally during stack unwinding. On hardware without vector extension support, this resulted in reading a nonexistent register.
This commit is contained in:
parent
0264d42dc7
commit
3acfef56b1
@ -4126,7 +4126,7 @@ inline reg_t Registers_riscv::getRegister(int regNum) const {
|
|||||||
return _registers[regNum];
|
return _registers[regNum];
|
||||||
if (regNum == UNW_RISCV_VLENB) {
|
if (regNum == UNW_RISCV_VLENB) {
|
||||||
reg_t vlenb;
|
reg_t vlenb;
|
||||||
__asm__("csrr %0, 0xC22" : "=r"(vlenb));
|
__asm__ volatile("csrr %0, 0xC22" : "=r"(vlenb));
|
||||||
return vlenb;
|
return vlenb;
|
||||||
}
|
}
|
||||||
_LIBUNWIND_ABORT("unsupported riscv register");
|
_LIBUNWIND_ABORT("unsupported riscv register");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user