zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 31e755df6f3ae7e7c5a1457ca69f2d2cfb0af415 (tree)
parent df09d9c14a22098709bd8816e622e6dd785ac954
Author: Jakub Konka <kubkon@jakubkonka.com>
Date:   Wed,  9 Nov 2022 19:58:14 +0100

aarch64: handle .stack_argument_offset as a valid local var

Diffstat:
Msrc/arch/aarch64/CodeGen.zig | 15+++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)

diff --git 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