From d25c93a868585e4e2f5941fcff15fa49c90510e9 Mon Sep 17 00:00:00 2001 From: Jakub Konka Date: Tue, 13 Aug 2024 09:56:17 +0200 Subject: x86_64: emit call rel32 for near calls with linker reloc --- src/link/Elf/Atom.zig | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/link') diff --git a/src/link/Elf/Atom.zig b/src/link/Elf/Atom.zig index 31ba0d642e..32583b39d7 100644 --- a/src/link/Elf/Atom.zig +++ b/src/link/Elf/Atom.zig @@ -1215,12 +1215,11 @@ const x86_64 = struct { ); }, - .PLT32 => try cwriter.writeInt(i32, @as(i32, @intCast(S + A - P)), .little), - - .PC32 => { + .PLT32 => { const S_ = if (target.flags.zig_jump_table) ZJT else S; try cwriter.writeInt(i32, @as(i32, @intCast(S_ + A - P)), .little); }, + .PC32 => try cwriter.writeInt(i32, @as(i32, @intCast(S + A - P)), .little), .GOTPCREL => try cwriter.writeInt(i32, @as(i32, @intCast(G + GOT + A - P)), .little), .GOTPC32 => try cwriter.writeInt(i32, @as(i32, @intCast(GOT + A - P)), .little), @@ -1620,7 +1619,7 @@ const x86_64 = struct { const bits = @import("../../arch/x86_64/bits.zig"); const encoder = @import("../../arch/x86_64/encoder.zig"); const Disassembler = @import("../../arch/x86_64/Disassembler.zig"); - const Immediate = bits.Immediate; + const Immediate = Instruction.Immediate; const Instruction = encoder.Instruction; }; -- cgit v1.2.3