authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2024-08-06 22:28:38+02:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2024-08-07 10:21:03+02:00
log89db24ec6d6195cc10f17bf21dd9bf23e6ff1bf1
treed07d4fdbc63acb4d68ffc02969f10dfaad98637d
parente99818c602f7e2f75c62be7c4329688c8fa5afe1

elf: fix .eh_frame calc in relocatable mode


2 files changed, 7 insertions(+), 3 deletions(-)

src/link/Elf.zig+4
......@@ -5860,6 +5860,10 @@ pub const Ref = struct {
58605860 index: u32,
58615861 file: u32,
58625862
5863 pub fn eql(ref: Ref, other: Ref) bool {
5864 return ref.index == other.index and ref.file == other.file;
5865 }
5866
58635867 pub fn format(
58645868 ref: Ref,
58655869 comptime unused_fmt_string: []const u8,
src/link/Elf/eh_frame.zig+3-3
......@@ -145,10 +145,10 @@ pub const Cie = struct {
145145 if (cie_rel.r_addend != other_rel.r_addend) return false;
146146
147147 const cie_object = elf_file.file(cie.file_index).?.object;
148 const cie_ref = cie_object.resolveSymbol(cie_rel.r_sym(), elf_file);
148149 const other_object = elf_file.file(other.file_index).?.object;
149 const cie_sym = cie_object.symbols.items[cie_rel.r_sym()];
150 const other_sym = other_object.symbols.items[other_rel.r_sym()];
151 if (!std.mem.eql(u8, std.mem.asBytes(&cie_sym), std.mem.asBytes(&other_sym))) return false;
150 const other_ref = other_object.resolveSymbol(other_rel.r_sym(), elf_file);
151 if (!cie_ref.eql(other_ref)) return false;
152152 }
153153 return true;
154154 }