diff options
| author | Jakub Konka <kubkon@jakubkonka.com> | 2022-11-09 19:58:14 +0100 |
|---|---|---|
| committer | Jakub Konka <kubkon@jakubkonka.com> | 2022-11-09 19:58:14 +0100 |
| commit | 31e755df6f3ae7e7c5a1457ca69f2d2cfb0af415 (patch) | |
| tree | 35e6e4b9263a0e66280b9f2783f6d72b7a70a4ea /src | |
| parent | df09d9c14a22098709bd8816e622e6dd785ac954 (diff) | |
| download | zig-31e755df6f3ae7e7c5a1457ca69f2d2cfb0af415.tar.gz zig-31e755df6f3ae7e7c5a1457ca69f2d2cfb0af415.zip | |
aarch64: handle .stack_argument_offset as a valid local var
Diffstat (limited to 'src')
| -rw-r--r-- | src/arch/aarch64/CodeGen.zig | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/arch/aarch64/CodeGen.zig b/src/arch/aarch64/CodeGen.zig index a117e4a083..e672364dc2 100644 --- a/src/arch/aarch64/CodeGen.zig +++ b/src/arch/aarch64/CodeGen.zig @@ -261,14 +261,23 @@ const DbgInfoReloc = struct { .ptr_stack_offset, .stack_offset, - => |off| { + .stack_argument_offset, + => |offset| { + const adjusted_offset = switch (reloc.mcv) { + .ptr_stack_offset, + .stack_offset, + => -@intCast(i32, offset), + .stack_argument_offset => @intCast(i32, function.saved_regs_stack_space + offset), + else => unreachable, + }; + try dbg_info.ensureUnusedCapacity(7); const fixup = dbg_info.items.len; dbg_info.appendSliceAssumeCapacity(&[2]u8{ // DW.AT.location, DW.FORM.exprloc 1, // we will backpatch it after we encode the displacement in LEB128 Register.x29.dwarfLocOpDeref(), // frame pointer }); - leb128.writeILEB128(dbg_info.writer(), -@intCast(i32, off)) catch unreachable; + leb128.writeILEB128(dbg_info.writer(), adjusted_offset) catch unreachable; dbg_info.items[fixup] += @intCast(u8, dbg_info.items.len - fixup - 2); }, @@ -353,8 +362,6 @@ const DbgInfoReloc = struct { }); }, - .stack_argument_offset => unreachable, - else => { try dbg_info.ensureUnusedCapacity(2); dbg_info.appendSliceAssumeCapacity(&[2]u8{ // DW.AT.location, DW.FORM.exprloc |
