diff options
author | Nick Desaulniers <ndesaulniers@google.com> | 2021-05-17 11:41:24 -0700 |
---|---|---|
committer | Nick Desaulniers <ndesaulniers@google.com> | 2021-05-17 11:49:22 -0700 |
commit | 0f417789192e74f9d2fad0f6aee4efc394257176 (patch) | |
tree | 03415c4e2111e4b062db7577106f8894e8d38c13 /llvm/lib/CodeGen/CommandFlags.cpp | |
parent | c870e36be1b21c1f306927fc9eb983390e434278 (diff) | |
download | llvm-0f417789192e74f9d2fad0f6aee4efc394257176.zip llvm-0f417789192e74f9d2fad0f6aee4efc394257176.tar.gz llvm-0f417789192e74f9d2fad0f6aee4efc394257176.tar.bz2 |
[AArch64] Support customizing stack protector guard
Follow up to D88631 but for aarch64; the Linux kernel uses the command
line flags:
1. -mstack-protector-guard=sysreg
2. -mstack-protector-guard-reg=sp_el0
3. -mstack-protector-guard-offset=0
to use the system register sp_el0 for the stack canary, enabling the
kernel to have a unique stack canary per task (like a thread, but not
limited to userspace as the kernel can preempt itself).
Address pr/47341 for aarch64.
Fixes: https://github.com/ClangBuiltLinux/linux/issues/289
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed By: xiangzhangllvm, DavidSpickett, dmgreen
Differential Revision: https://reviews.llvm.org/D100919
Diffstat (limited to 'llvm/lib/CodeGen/CommandFlags.cpp')
-rw-r--r-- | llvm/lib/CodeGen/CommandFlags.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/CommandFlags.cpp b/llvm/lib/CodeGen/CommandFlags.cpp index b8f1ca1..593a330 100644 --- a/llvm/lib/CodeGen/CommandFlags.cpp +++ b/llvm/lib/CodeGen/CommandFlags.cpp @@ -508,6 +508,8 @@ codegen::getStackProtectorGuardMode(llvm::TargetOptions &Options) { return StackProtectorGuards::TLS; if (getStackProtectorGuard() == "global") return StackProtectorGuards::Global; + if (getStackProtectorGuard() == "sysreg") + return StackProtectorGuards::SysReg; if (getStackProtectorGuard() != "none") { ErrorOr<std::unique_ptr<MemoryBuffer>> MBOrErr = MemoryBuffer::getFile(getStackProtectorGuard()); |