authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-08-31 20:03:41+02:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-09-07 22:42:55+02:00
log51fba37af70283427a7ef5d2f2fd39f97aaa1e35
tree06bc9cf2718be8296e88184b45936e209f24c331
parenta35f156cf60ed3d8095c15c4ab26aee267761a56

coff: add relocation for call_extern


1 files changed, 12 insertions(+), 0 deletions(-)

src/arch/x86_64/Emit.zig+12
...@@ -1157,6 +1157,18 @@ fn mirCallExtern(emit: *Emit, inst: Mir.Inst.Index) InnerError!void {...@@ -1157,6 +1157,18 @@ fn mirCallExtern(emit: *Emit, inst: Mir.Inst.Index) InnerError!void {
1157 .length = 2,1157 .length = 2,
1158 .@"type" = @enumToInt(std.macho.reloc_type_x86_64.X86_64_RELOC_BRANCH),1158 .@"type" = @enumToInt(std.macho.reloc_type_x86_64.X86_64_RELOC_BRANCH),
1159 });1159 });
1160 } else if (emit.bin_file.cast(link.File.Coff)) |coff_file| {
1161 // Add relocation to the decl.
1162 const atom = coff_file.atom_by_index_table.get(relocation.atom_index).?;
1163 try atom.addRelocation(coff_file, .{
1164 .@"type" = .direct,
1165 .target = .{ .sym_index = relocation.sym_index, .file = null },
1166 .offset = offset,
1167 .addend = 0,
1168 .pcrel = true,
1169 .length = 2,
1170 .prev_vaddr = atom.getSymbol(coff_file).value,
1171 });
1160 } else {1172 } else {
1161 return emit.fail("TODO implement call_extern for linking backends different than MachO", .{});1173 return emit.fail("TODO implement call_extern for linking backends different than MachO", .{});
1162 }1174 }