aboutsummaryrefslogtreecommitdiff
path: root/src/link/Wasm.zig
diff options
context:
space:
mode:
authorLuuk de Gram <luuk@degram.dev>2022-09-01 22:02:24 +0200
committerLuuk de Gram <luuk@degram.dev>2022-09-07 18:53:16 +0200
commit46c932a2c9650f14ae8035d7382d825bfabdc0a5 (patch)
treee819d6b20acb736af12a5b7f35ce4c34e17f3600 /src/link/Wasm.zig
parentc347751338a4a1e2874207674fb47908fd601484 (diff)
downloadzig-46c932a2c9650f14ae8035d7382d825bfabdc0a5.tar.gz
zig-46c932a2c9650f14ae8035d7382d825bfabdc0a5.zip
wasm-linker: perform debug relocations
This correctly performs a relocation for debug sections. The result is that the wasm-linker can now correctly create a binary from object files while preserving all debug information.
Diffstat (limited to 'src/link/Wasm.zig')
-rw-r--r--src/link/Wasm.zig12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/link/Wasm.zig b/src/link/Wasm.zig
index b17eeb57e9..2ff631d9ba 100644
--- a/src/link/Wasm.zig
+++ b/src/link/Wasm.zig
@@ -221,6 +221,18 @@ pub const SymbolLoc = struct {
}
return wasm_bin.string_table.get(wasm_bin.symbols.items[self.index].name);
}
+
+ /// From a given symbol location, returns the final location.
+ /// e.g. when a symbol was resolved and replaced by the symbol
+ /// in a different file, this will return said location.
+ /// If the symbol wasn't replaced by another, this will return
+ /// the given location itself.
+ pub fn finalLoc(self: SymbolLoc, wasm_bin: *const Wasm) SymbolLoc {
+ if (wasm_bin.discarded.get(self)) |new_loc| {
+ return new_loc.finalLoc(wasm_bin);
+ }
+ return self;
+ }
};
/// Generic string table that duplicates strings