diff options
author | Nicholas Wilson <nicholas@nicholaswilson.me.uk> | 2018-03-09 17:06:38 +0000 |
---|---|---|
committer | Nicholas Wilson <nicholas@nicholaswilson.me.uk> | 2018-03-09 17:06:38 +0000 |
commit | 2e55ee77e2b9f0d13d4a85852059d258a697cc5c (patch) | |
tree | c2c9a682be796a44cb9062b61cdc17fc77403718 /lld/wasm/InputFiles.cpp | |
parent | 95d9ccb2a0542d79ecf40f14784be20f96b494b1 (diff) | |
download | bcm5719-llvm-2e55ee77e2b9f0d13d4a85852059d258a697cc5c.tar.gz bcm5719-llvm-2e55ee77e2b9f0d13d4a85852059d258a697cc5c.zip |
[WebAssembly] Handle weak undefined functions with a synthetic stub
This error case is described in Linking.md. The operand for call requires
generation of a synthetic stub.
Differential Revision: https://reviews.llvm.org/D44028
llvm-svn: 327151
Diffstat (limited to 'lld/wasm/InputFiles.cpp')
-rw-r--r-- | lld/wasm/InputFiles.cpp | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/lld/wasm/InputFiles.cpp b/lld/wasm/InputFiles.cpp index 2c65c7bfd5c..12ee9ec6f8c 100644 --- a/lld/wasm/InputFiles.cpp +++ b/lld/wasm/InputFiles.cpp @@ -65,14 +65,8 @@ uint32_t ObjFile::calcNewIndex(const WasmRelocation &Reloc) const { uint32_t ObjFile::calcNewValue(const WasmRelocation &Reloc) const { switch (Reloc.Type) { case R_WEBASSEMBLY_TABLE_INDEX_I32: - case R_WEBASSEMBLY_TABLE_INDEX_SLEB: { - // The null case is possible, if you take the address of a weak function - // that's simply not supplied. - FunctionSymbol *Sym = getFunctionSymbol(Reloc.Index); - if (Sym->hasTableIndex()) - return Sym->getTableIndex(); - return 0; - } + case R_WEBASSEMBLY_TABLE_INDEX_SLEB: + return getFunctionSymbol(Reloc.Index)->getTableIndex(); case R_WEBASSEMBLY_MEMORY_ADDR_SLEB: case R_WEBASSEMBLY_MEMORY_ADDR_I32: case R_WEBASSEMBLY_MEMORY_ADDR_LEB: |