diff options
| author | Alex Rønne Petersen <alex@alexrp.com> | 2024-08-13 05:26:30 +0200 |
|---|---|---|
| committer | Alex Rønne Petersen <alex@alexrp.com> | 2024-08-15 10:56:33 +0200 |
| commit | 7a8e86e46ceb1350509b4296c2a45af45100df41 (patch) | |
| tree | c28f6eb1bdc590e3aaaeb01c3d5bce7b67b92206 /src/codegen | |
| parent | acad2fae4463d0f3df873b5c377c252954639116 (diff) | |
| download | zig-7a8e86e46ceb1350509b4296c2a45af45100df41.tar.gz zig-7a8e86e46ceb1350509b4296c2a45af45100df41.zip | |
llvm: Don't emit extra debug instructions for `dbg_var_val` in naked functions.
Diffstat (limited to 'src/codegen')
| -rw-r--r-- | src/codegen/llvm.zig | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index 23fdbb177b..1a62e89517 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -6743,7 +6743,10 @@ pub const FuncGen = struct { }, "", ); - } else if (owner_mod.optimize_mode == .Debug) { + } else if (owner_mod.optimize_mode == .Debug and !self.is_naked) { + // We avoid taking this path for naked functions because there's no guarantee that such + // functions even have a valid stack pointer, making the `alloca` + `store` unsafe. + const alignment = operand_ty.abiAlignment(pt).toLlvm(); const alloca = try self.buildAlloca(operand.typeOfWip(&self.wip), alignment); _ = try self.wip.store(.normal, operand, alloca, alignment); |
