aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2022-08-31 21:55:12 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2022-09-12 21:15:34 +0000
commitab56719acd98778fb2e48fa425ac7c8d27bdea86 (patch)
tree940b1cb0ac282f1600a50fba2bd6f31e3a0307b6 /llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
parent6607fdf7490c5bf73a8892bc08ed2dba55043ca8 (diff)
downloadllvm-ab56719acd98778fb2e48fa425ac7c8d27bdea86.zip
llvm-ab56719acd98778fb2e48fa425ac7c8d27bdea86.tar.gz
llvm-ab56719acd98778fb2e48fa425ac7c8d27bdea86.tar.bz2
[clang, llvm] Add __declspec(safebuffers), support it in CodeView
__declspec(safebuffers) is equivalent to __attribute__((no_stack_protector)). This information is recorded in CodeView. While we are here, add support for strict_gs_check.
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
index 16213af..a97eb9f 100644
--- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
@@ -1498,8 +1498,16 @@ void CodeViewDebug::beginFunctionImpl(const MachineFunction *MF) {
FPO |= FrameProcedureOptions::MarkedInline;
if (GV.hasFnAttribute(Attribute::Naked))
FPO |= FrameProcedureOptions::Naked;
- if (MFI.hasStackProtectorIndex())
+ if (MFI.hasStackProtectorIndex()) {
FPO |= FrameProcedureOptions::SecurityChecks;
+ if (GV.hasFnAttribute(Attribute::StackProtectStrong) ||
+ GV.hasFnAttribute(Attribute::StackProtectReq)) {
+ FPO |= FrameProcedureOptions::StrictSecurityChecks;
+ }
+ } else if (!GV.hasStackProtectorFnAttr()) {
+ // __declspec(safebuffers) disables stack guards.
+ FPO |= FrameProcedureOptions::SafeBuffers;
+ }
FPO |= FrameProcedureOptions(uint32_t(CurFn->EncodedLocalFramePtrReg) << 14U);
FPO |= FrameProcedureOptions(uint32_t(CurFn->EncodedParamFramePtrReg) << 16U);
if (Asm->TM.getOptLevel() != CodeGenOpt::None &&