Skip to content

Commit 1fd6554

Browse files
committed
IRGen: add sppreq instead of sspstrong for functions which need stack protection.
Now that Swift decides whether or not we need stack protection we should force LLVM to emit stack protection when we request it.
1 parent 614334f commit 1fd6554

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/IRGen/IRGenModule.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1265,7 +1265,7 @@ void IRGenModule::constructInitialFnAttributes(
12651265
Attrs.removeAttribute(llvm::Attribute::OptimizeForSize);
12661266
}
12671267
if (stackProtector == StackProtectorMode::StackProtector) {
1268-
Attrs.addAttribute(llvm::Attribute::StackProtectStrong);
1268+
Attrs.addAttribute(llvm::Attribute::StackProtectReq);
12691269
Attrs.addAttribute("stack-protector-buffer-size", llvm::utostr(8));
12701270
}
12711271
}

test/IRGen/stack_protector.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ public func noStackProtector() {
2121
g(x)
2222
g(x) // avoid function merging by calling `g` two times
2323
}
24+
// CHECK: [[SSPATTRS]] = { sspreq {{.*}}"stack-protector-buffer-size"="8"
2425

25-
// CHECK: [[SSPATTRS]] = { sspstrong {{.*}}"stack-protector-buffer-size"="8"

0 commit comments

Comments
 (0)