diff options
author | Sam Clegg <sbc@chromium.org> | 2020-11-10 17:46:52 -0800 |
---|---|---|
committer | Sam Clegg <sbc@chromium.org> | 2020-11-13 07:59:29 -0800 |
commit | a28a466210199559d38251c11f30515cc83eadd6 (patch) | |
tree | f3b16673063e5964614ba875fa5f47d18fb23575 /llvm/lib/Object/WasmObjectFile.cpp | |
parent | 0fd6a04ba4dbf039fbd11eca29886d9d06bc736a (diff) | |
download | llvm-a28a466210199559d38251c11f30515cc83eadd6.zip llvm-a28a466210199559d38251c11f30515cc83eadd6.tar.gz llvm-a28a466210199559d38251c11f30515cc83eadd6.tar.bz2 |
[WebAssembly] Add new relocation type for TLS data symbols
These relocations represent offsets from the __tls_base symbol.
Previously we were just using normal MEMORY_ADDR relocations and relying
on the linker to select a segment-offset rather and absolute value in
Symbol::getVirtualAddress(). Using an explicit relocation type allows
allow us to clearly distinguish absolute from relative relocations based
on the relocation information alone.
One place this is useful is being able to reject absolute relocation in
the PIC case, but still accept TLS relocations.
Differential Revision: https://reviews.llvm.org/D91276
Diffstat (limited to 'llvm/lib/Object/WasmObjectFile.cpp')
-rw-r--r-- | llvm/lib/Object/WasmObjectFile.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/lib/Object/WasmObjectFile.cpp b/llvm/lib/Object/WasmObjectFile.cpp index f8ca654..63f2742 100644 --- a/llvm/lib/Object/WasmObjectFile.cpp +++ b/llvm/lib/Object/WasmObjectFile.cpp @@ -855,6 +855,7 @@ Error WasmObjectFile::parseRelocSection(StringRef Name, ReadContext &Ctx) { case wasm::R_WASM_MEMORY_ADDR_SLEB: case wasm::R_WASM_MEMORY_ADDR_I32: case wasm::R_WASM_MEMORY_ADDR_REL_SLEB: + case wasm::R_WASM_MEMORY_ADDR_TLS_SLEB: if (!isValidDataSymbol(Reloc.Index)) return make_error<GenericBinaryError>("Bad relocation data index", object_error::parse_failed); |