diff --git a/src/link/MachO/ZldAtom.zig b/src/link/MachO/ZldAtom.zig index 44cc609b9ad7bc5409eeb76ef2865bc13e13a0df..ea173b73ad6303b47b067cf401c75e4833a92a20 100644 --- a/src/link/MachO/ZldAtom.zig +++ b/src/link/MachO/ZldAtom.zig @@ -843,8 +843,10 @@ fn resolveRelocsX86( log.debug(" | target_addr = 0x{x}", .{adjusted_target_addr}); const disp = try calcPcRelativeDisplacementX86(source_addr, adjusted_target_addr, 0); - // We need to rewrite the opcode from movq to leaq. - atom_code[rel_offset - 2] = 0x8d; + if (zld.tlv_ptr_table.get(target) == null) { + // We need to rewrite the opcode from movq to leaq. + atom_code[rel_offset - 2] = 0x8d; + } mem.writeIntLittle(i32, atom_code[rel_offset..][0..4], disp); },