authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-11-09 19:58:14+01:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-11-09 19:58:14+01:00
log31e755df6f3ae7e7c5a1457ca69f2d2cfb0af415
tree35e6e4b9263a0e66280b9f2783f6d72b7a70a4ea
parentdf09d9c14a22098709bd8816e622e6dd785ac954

aarch64: handle .stack_argument_offset as a valid local var


1 files changed, 11 insertions(+), 4 deletions(-)

src/arch/aarch64/CodeGen.zig+11-4
...@@ -261,14 +261,23 @@ const DbgInfoReloc = struct {...@@ -261,14 +261,23 @@ const DbgInfoReloc = struct {
261261
262 .ptr_stack_offset,262 .ptr_stack_offset,
263 .stack_offset,263 .stack_offset,
264 => |off| {264 .stack_argument_offset,
265 => |offset| {
266 const adjusted_offset = switch (reloc.mcv) {
267 .ptr_stack_offset,
268 .stack_offset,
269 => -@intCast(i32, offset),
270 .stack_argument_offset => @intCast(i32, function.saved_regs_stack_space + offset),
271 else => unreachable,
272 };
273
265 try dbg_info.ensureUnusedCapacity(7);274 try dbg_info.ensureUnusedCapacity(7);
266 const fixup = dbg_info.items.len;275 const fixup = dbg_info.items.len;
267 dbg_info.appendSliceAssumeCapacity(&[2]u8{ // DW.AT.location, DW.FORM.exprloc276 dbg_info.appendSliceAssumeCapacity(&[2]u8{ // DW.AT.location, DW.FORM.exprloc
268 1, // we will backpatch it after we encode the displacement in LEB128277 1, // we will backpatch it after we encode the displacement in LEB128
269 Register.x29.dwarfLocOpDeref(), // frame pointer278 Register.x29.dwarfLocOpDeref(), // frame pointer
270 });279 });
271 leb128.writeILEB128(dbg_info.writer(), -@intCast(i32, off)) catch unreachable;280 leb128.writeILEB128(dbg_info.writer(), adjusted_offset) catch unreachable;
272 dbg_info.items[fixup] += @intCast(u8, dbg_info.items.len - fixup - 2);281 dbg_info.items[fixup] += @intCast(u8, dbg_info.items.len - fixup - 2);
273 },282 },
274283
...@@ -353,8 +362,6 @@ const DbgInfoReloc = struct {...@@ -353,8 +362,6 @@ const DbgInfoReloc = struct {
353 });362 });
354 },363 },
355364
356 .stack_argument_offset => unreachable,
357
358 else => {365 else => {
359 try dbg_info.ensureUnusedCapacity(2);366 try dbg_info.ensureUnusedCapacity(2);
360 dbg_info.appendSliceAssumeCapacity(&[2]u8{ // DW.AT.location, DW.FORM.exprloc367 dbg_info.appendSliceAssumeCapacity(&[2]u8{ // DW.AT.location, DW.FORM.exprloc