[llvm] Skip stack protectors on alloca's which have new metadata to opt out (PR #170229)

via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 4 14:57:17 PST 2025


================
@@ -431,6 +431,11 @@ bool SSPLayoutAnalysis::requiresStackProtector(Function *F,
   for (const BasicBlock &BB : *F) {
     for (const Instruction &I : BB) {
       if (const AllocaInst *AI = dyn_cast<AllocaInst>(&I)) {
+        if (MDNode* MD = AI->getMetadata("stack-protector")) {
----------------
apple-fcloutier wrote:

I like the idea, though this is meant to support `__attribute__((no_stack_protector))` on locals and I don't think there's a matching `__attribute__((stack_protector))` to piggyback on. Could be useful in some paranoid cases, though.

https://github.com/llvm/llvm-project/pull/170229


More information about the llvm-commits mailing list