zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 4c2b34e8abd1fc2091eeb10798658bd9bb3910f5 (tree)
parent 7556b32840eabb027945d9a30b57bb9cb46cf0bb
Author: Jakub Konka <kubkon@jakubkonka.com>
Date:   Fri,  9 Aug 2024 08:35:46 +0200

elf: relax R_X86_64_32 into jump table indirection if zig_offset_table set

Diffstat:
Msrc/link/Elf/Atom.zig | 5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/link/Elf/Atom.zig b/src/link/Elf/Atom.zig @@ -1254,7 +1254,10 @@ const x86_64 = struct { try cwriter.writeInt(i32, @as(i32, @intCast(G + GOT + A - P)), .little); }, - .@"32" => try cwriter.writeInt(u32, @as(u32, @truncate(@as(u64, @intCast(S + A)))), .little), + .@"32" => { + const S_ = if (target.flags.zig_offset_table) target.zigOffsetTableAddress(elf_file) else S; + try cwriter.writeInt(u32, @as(u32, @truncate(@as(u64, @intCast(S_ + A)))), .little); + }, .@"32S" => try cwriter.writeInt(i32, @as(i32, @truncate(S + A)), .little), .TPOFF32 => try cwriter.writeInt(i32, @as(i32, @truncate(S + A - TP)), .little),