elf: fix emitting cross-section relocs for .debug* sections

This commit is contained in:
Jakub Konka 2024-08-19 10:15:23 +02:00 committed by Jacob Young
parent c4d820b3f1
commit fe6dfd5090

View File

@ -238,7 +238,7 @@ pub fn flushModule(self: *ZigObject, elf_file: *Elf, tid: Zcu.PerThread.Id) !voi
unit.header_len + unit.getEntry(source_entry).off
else
0);
const r_addend: i64 = @intCast(reloc.target_off + (if (reloc.target_entry.unwrap()) |target_entry|
const r_addend: i64 = @intCast(target_unit.off + reloc.target_off + (if (reloc.target_entry.unwrap()) |target_entry|
target_unit.header_len + target_unit.getEntry(target_entry).assertNonEmpty(unit, sect, dwarf).off
else
0));