diff options
| author | Luuk de Gram <luuk@degram.dev> | 2023-03-12 15:23:58 +0100 |
|---|---|---|
| committer | Luuk de Gram <luuk@degram.dev> | 2023-03-18 20:13:25 +0100 |
| commit | b0024c48841b78a962918cd4ab20459ba6451050 (patch) | |
| tree | 55a213e4ee740d77306ae1c4ac769bb6f1a586c9 /src/link/Wasm/Atom.zig | |
| parent | 49d37e2d179948f526f500043c6ea9ae324e9476 (diff) | |
| download | zig-b0024c48841b78a962918cd4ab20459ba6451050.tar.gz zig-b0024c48841b78a962918cd4ab20459ba6451050.zip | |
wasm-linker: basic TLS support
Linker now parses segments with regards to TLS segments. If the name
represents a TLS segment but does not contain the TLS flag, we set it
manually as the object file is created using an older compiler (LLVM).
For now we panic when we find a TLS relocation and implement those
later.
Diffstat (limited to 'src/link/Wasm/Atom.zig')
| -rw-r--r-- | src/link/Wasm/Atom.zig | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/link/Wasm/Atom.zig b/src/link/Wasm/Atom.zig index 0c9d761f05..7d2f5a6696 100644 --- a/src/link/Wasm/Atom.zig +++ b/src/link/Wasm/Atom.zig @@ -126,10 +126,12 @@ pub fn resolveRelocs(atom: *Atom, wasm_bin: *const Wasm) void { .R_WASM_TABLE_INDEX_SLEB, .R_WASM_TABLE_NUMBER_LEB, .R_WASM_TYPE_INDEX_LEB, + .R_WASM_MEMORY_ADDR_TLS_SLEB, => leb.writeUnsignedFixed(5, atom.code.items[reloc.offset..][0..5], @intCast(u32, value)), .R_WASM_MEMORY_ADDR_LEB64, .R_WASM_MEMORY_ADDR_SLEB64, .R_WASM_TABLE_INDEX_SLEB64, + .R_WASM_MEMORY_ADDR_TLS_SLEB64, => leb.writeUnsignedFixed(10, atom.code.items[reloc.offset..][0..10], value), } } @@ -190,5 +192,10 @@ fn relocationValue(atom: Atom, relocation: types.Relocation, wasm_bin: *const Wa const rel_value = @intCast(i32, target_atom.offset + offset) + relocation.addend; return @intCast(u32, rel_value); }, + .R_WASM_MEMORY_ADDR_TLS_SLEB, + .R_WASM_MEMORY_ADDR_TLS_SLEB64, + => { + @panic("TODO: Implement TLS relocations"); + }, } } |
