The enum values for AArch64 registers are not all consecutive.
Therefore, the computation
"__llvm_slsblr_thunk_x" + utostr(Reg - AArch64::X0)
is not always correct. utostr(Reg - AArch64::X0) will not generate the
expected string for the registers that do not have consecutive values in
the enum.
This happened to work for most registers, but does not for AArch64::FP
(i.e. register X29).
This can get triggered when the X29 is not used as a frame pointer.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/Target/AArch64/AArch64SLSHardening.cpp | ||
---|---|---|
144–145 | Yes, agreed. Thanks for the suggestion. I think it made the code quite a bit nicer. | |
189 | After changing the structure of SLSBLRThunks, it seemed better to just search inline using llvm::find_if rather than in a separate function, so this comment does not apply anymore to the new version of the code. | |
200 | Same reply as above too. |
I think it would be better to change these two arrays into one array of structs, so that the relationship between them is more obvious.