summaryrefslogtreecommitdiffstats
path: root/lld/wasm/InputFiles.cpp
diff options
context:
space:
mode:
authorNicholas Wilson <nicholas@nicholaswilson.me.uk>2018-03-09 17:06:38 +0000
committerNicholas Wilson <nicholas@nicholaswilson.me.uk>2018-03-09 17:06:38 +0000
commit2e55ee77e2b9f0d13d4a85852059d258a697cc5c (patch)
treec2c9a682be796a44cb9062b61cdc17fc77403718 /lld/wasm/InputFiles.cpp
parent95d9ccb2a0542d79ecf40f14784be20f96b494b1 (diff)
downloadbcm5719-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.cpp10
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:
OpenPOWER on IntegriCloud