diff options
Diffstat (limited to 'src/codegen')
| -rw-r--r-- | src/codegen/llvm.zig | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index 8c84f61a81..0898c8fe87 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -711,9 +711,14 @@ pub const Object = struct { DeclGen.removeFnAttr(llvm_func, "noinline"); } - // TODO: port these over from stage1 - // addLLVMFnAttr(llvm_fn, "sspstrong"); - // addLLVMFnAttrStr(llvm_fn, "stack-protector-buffer-size", "4"); + // TODO: disable this if safety is off for the function scope + const ssp_buf_size = module.comp.bin_file.options.stack_protector; + if (ssp_buf_size != 0) { + var buf: [12]u8 = undefined; + const arg = std.fmt.bufPrintZ(&buf, "{d}", .{ssp_buf_size}) catch unreachable; + dg.addFnAttr(llvm_func, "sspstrong"); + dg.addFnAttrString(llvm_func, "stack-protector-buffer-size", arg); + } // TODO: disable this if safety is off for the function scope if (module.comp.bin_file.options.stack_check) { |
