diff options
| author | Jakub Konka <kubkon@jakubkonka.com> | 2024-08-09 08:35:46 +0200 |
|---|---|---|
| committer | Jakub Konka <kubkon@jakubkonka.com> | 2024-08-13 13:30:24 +0200 |
| commit | 4c2b34e8abd1fc2091eeb10798658bd9bb3910f5 (patch) | |
| tree | 96b0a77ab8d31a296ad84b32c00844574b6a177d | |
| parent | 7556b32840eabb027945d9a30b57bb9cb46cf0bb (diff) | |
| download | zig-4c2b34e8abd1fc2091eeb10798658bd9bb3910f5.tar.gz zig-4c2b34e8abd1fc2091eeb10798658bd9bb3910f5.zip | |
elf: relax R_X86_64_32 into jump table indirection if zig_offset_table set
| -rw-r--r-- | src/link/Elf/Atom.zig | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/link/Elf/Atom.zig b/src/link/Elf/Atom.zig index 6fa5d700ef..b5db642c40 100644 --- 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), |
