@@ -152,9 +152,11 @@ pub const Cie = struct {
152
152
if (cie_rel .r_type () != other_rel .r_type ()) return false ;
153
153
if (cie_rel .r_addend != other_rel .r_addend ) return false ;
154
154
155
- const cie_sym = cie .getObject (elf_file ).symbols .items [cie_rel .r_sym ()];
156
- const other_sym = other .getObject (elf_file ).symbols .items [other_rel .r_sym ()];
157
- if (! std .mem .eql (u8 , std .mem .asBytes (& cie_sym ), std .mem .asBytes (& other_sym ))) return false ;
155
+ const cie_object = elf_file .getFile (cie .file ).? .object ;
156
+ const cie_ref = cie_object .resolveSymbol (cie_rel .r_sym (), elf_file );
157
+ const other_object = elf_file .getFile (other .file ).? .object ;
158
+ const other_ref = other_object .resolveSymbol (other_rel .r_sym (), elf_file );
159
+ if (! cie_ref .eql (other_ref )) return false ;
158
160
}
159
161
return true ;
160
162
}
@@ -485,17 +487,19 @@ pub fn writeEhFrameRelocs(elf_file: *Elf, writer: anytype) !void {
485
487
for (object .cies .items ) | cie | {
486
488
if (! cie .alive ) continue ;
487
489
for (cie .getRelocs (elf_file )) | rel | {
488
- const sym = object .symbols .items [rel .r_sym ()];
489
- const out_rel = emitReloc (elf_file , cie , sym , rel );
490
+ const sym_ref = object .resolveSymbol (rel .r_sym (), elf_file );
491
+ const sym = elf_file .getSymbol (sym_ref ).? ;
492
+ const out_rel = emitReloc (elf_file , cie , sym .* , rel );
490
493
try writer .writeStruct (out_rel );
491
494
}
492
495
}
493
496
494
497
for (object .fdes .items ) | fde | {
495
498
if (! fde .alive ) continue ;
496
499
for (fde .getRelocs (elf_file )) | rel | {
497
- const sym = object .symbols .items [rel .r_sym ()];
498
- const out_rel = emitReloc (elf_file , fde , sym , rel );
500
+ const sym_ref = object .resolveSymbol (rel .r_sym (), elf_file );
501
+ const sym = elf_file .getSymbol (sym_ref ).? ;
502
+ const out_rel = emitReloc (elf_file , fde , sym .* , rel );
499
503
try writer .writeStruct (out_rel );
500
504
}
501
505
}
0 commit comments