summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJF Bastien <jfb@chromium.org>2016-01-30 08:13:32 -0800
committerJF Bastien <jfb@chromium.org>2016-01-30 08:13:32 -0800
commit2d966169a94a5f852491310c4f8868f71ea65631 (patch)
tree9c891a74b401b8ae84e0efcc863c0da03276a112
parent4a182068c6f3360dbf9c27420bbb0a11f34af3dd (diff)
downloadbinaryen-2d966169a94a5f852491310c4f8868f71ea65631.tar.gz
binaryen-2d966169a94a5f852491310c4f8868f71ea65631.tar.bz2
binaryen-2d966169a94a5f852491310c4f8868f71ea65631.zip
Do relocation properly when ignoring unknown symbols
My previous patch didn't perform the relocation, so it stuck around. Make it a nullptr instead.
-rw-r--r--src/s2wasm.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/s2wasm.h b/src/s2wasm.h
index caf07f965..5fd59c674 100644
--- a/src/s2wasm.h
+++ b/src/s2wasm.h
@@ -1164,9 +1164,11 @@ class S2WasmBuilder {
if (wasm.functionsMap.count(name) == 0) {
std::cerr << "Unknown symbol: " << name << '\n';
if (!ignoreUnknownSymbols) abort();
+ *(relocation.data) = 0;
+ } else {
+ ensureFunctionIndex(name);
+ *(relocation.data) = functionIndexes[name] + relocation.offset;
}
- ensureFunctionIndex(name);
- *(relocation.data) = functionIndexes[name] + relocation.offset;
}
}
}