================
@@ -447,19 +558,56 @@ bool SSPLayoutAnalysis::requiresStackProtector(Function
*F,
});
NeedsProtector = true;
Strong = true; // Use the same heuristic as strong to determine SSPLayout
- } else if (F->hasFnAttribute(Attribute::StackProtectStrong))
- Strong = true;
- else if (!F->hasFnAttribute(Attribute::StackProtect))
+ } else if (F->hasFnAttribute(Attribute::StackProtectStrong)) {
+ // clang-cl's default /GS asks for MSVC's GS-buffer rules rather than the
+ // GCC-compatible strong heuristic. An explicit sspreq (handled above)
+ // still wins over both.
+ GSBuffer = F->getFnAttribute(GSBufferAttr).getValueAsBool();
+ Strong = !GSBuffer;
+ } else if (F->hasFnAttribute(Attribute::StackProtect)) {
+ GSBuffer = F->getFnAttribute(GSBufferAttr).getValueAsBool();
+ } else {
+ return false;
+ }
+
+ // MSVC's /GS does not protect functions that take a variable argument list.
----------------
PanTao2 wrote:
I removed this.
https://github.com/llvm/llvm-project/pull/225626
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits