aboutsummaryrefslogtreecommitdiff
path: root/src/link/Wasm/Atom.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/link/Wasm/Atom.zig')
-rw-r--r--src/link/Wasm/Atom.zig13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/link/Wasm/Atom.zig b/src/link/Wasm/Atom.zig
index 4f16a1c2fb..f716cd56ee 100644
--- a/src/link/Wasm/Atom.zig
+++ b/src/link/Wasm/Atom.zig
@@ -168,12 +168,13 @@ fn relocationValue(atom: Atom, relocation: types.Relocation, wasm_bin: *const Wa
.R_WASM_TABLE_INDEX_SLEB,
.R_WASM_TABLE_INDEX_SLEB64,
=> return wasm_bin.function_table.get(target_loc) orelse 0,
- .R_WASM_TYPE_INDEX_LEB => return blk: {
- if (symbol.isUndefined()) {
- const imp = wasm_bin.imports.get(target_loc).?;
- break :blk imp.kind.function;
- }
- break :blk wasm_bin.functions.values()[symbol.index - wasm_bin.imported_functions_count].type_index;
+ .R_WASM_TYPE_INDEX_LEB => {
+ const file_index = atom.file orelse {
+ return relocation.index;
+ };
+
+ const original_type = wasm_bin.objects.items[file_index].func_types[relocation.index];
+ return wasm_bin.getTypeIndex(original_type).?;
},
.R_WASM_GLOBAL_INDEX_I32,
.R_WASM_GLOBAL_INDEX_LEB,