[PATCH] D146463: [CodeGen][RISCV] Change Shadow Call Stack Register to X3

Roland McGrath via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 29 18:02:53 PDT 2023


mcgrathr added a comment.

In D146463#4232252 <https://reviews.llvm.org/D146463#4232252>, @craig.topper wrote:

> In D146463#4232221 <https://reviews.llvm.org/D146463#4232221>, @mcgrathr wrote:
>
>> In D146463#4232214 <https://reviews.llvm.org/D146463#4232214>, @craig.topper wrote:
>>
>>> Does the kernel populate the initial value of the register for the shadow stack or is that done by a runtime inside the application?
>>
>> This is a change to code generation and is orthogonal to how the runtime environment supports the ABI requirement. The details depend on the particular runtime environment, which is not the province of the compiler backend.
>
> I ask because GP is set in crtbegin.o on Linux today. So if its the kernel that populates it, then GP isn't valid choice for Linux without changing crtbegin.

To use ShadowCallStack, executables need to be built with `-msmall-data-limit=0` and the runtime environment they use needs to meet the ABI.  Neither of those things is provided out of the box for Linux, just as on AArch64 neither building with `-ffixed-x18` nor a runtime environment meeting the ABI exists out of the box on Linux. If a runtime environment for Linux were to support the ShadowCallStack ABI, that would be done in startup code that runs after the code injected by crtbegin.o and before any code built for the ShadowCallStack is expected to be usable, such as in the libc startup code.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146463/new/

https://reviews.llvm.org/D146463



More information about the llvm-commits mailing list