aboutsummaryrefslogtreecommitdiff
path: root/src/link/Wasm/Atom.zig
diff options
context:
space:
mode:
authorLuuk de Gram <luuk@degram.dev>2022-04-13 22:10:02 +0200
committerLuuk de Gram <luuk@degram.dev>2022-04-14 22:53:13 +0200
commitcf37101108e56412e958a8b597bae84649893b6f (patch)
tree29979e1e3e82acba2b6da1893b834a8636993ede /src/link/Wasm/Atom.zig
parent321a1642693b74481e12cae8d7be089c6ef45cc1 (diff)
downloadzig-cf37101108e56412e958a8b597bae84649893b6f.tar.gz
zig-cf37101108e56412e958a8b597bae84649893b6f.zip
wasm-linker: Add function table indexes
When linking with an object file, verify if a relocation is a table index relocation. If that's the case, add the relocation target to the function table.
Diffstat (limited to 'src/link/Wasm/Atom.zig')
-rw-r--r--src/link/Wasm/Atom.zig2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/link/Wasm/Atom.zig b/src/link/Wasm/Atom.zig
index a3e1c25190..fc45648d9a 100644
--- a/src/link/Wasm/Atom.zig
+++ b/src/link/Wasm/Atom.zig
@@ -158,7 +158,7 @@ fn relocationValue(self: Atom, relocation: types.Relocation, wasm_bin: *const Wa
.R_WASM_TABLE_INDEX_I64,
.R_WASM_TABLE_INDEX_SLEB,
.R_WASM_TABLE_INDEX_SLEB64,
- => return wasm_bin.function_table.get(relocation.index) orelse 0,
+ => return wasm_bin.function_table.get(target_loc) orelse 0,
.R_WASM_TYPE_INDEX_LEB => return wasm_bin.functions.items[symbol.index].type_index,
.R_WASM_GLOBAL_INDEX_I32,
.R_WASM_GLOBAL_INDEX_LEB,