summaryrefslogtreecommitdiff
path: root/src/s2wasm.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/s2wasm.h')
-rw-r--r--src/s2wasm.h21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/s2wasm.h b/src/s2wasm.h
index 8ef1135dd..caf07f965 100644
--- a/src/s2wasm.h
+++ b/src/s2wasm.h
@@ -36,12 +36,19 @@ cashew::IString EMSCRIPTEN_ASM_CONST("emscripten_asm_const");
class S2WasmBuilder {
AllocatingModule& wasm;
MixedArena& allocator;
- const char *s;
+ const char* s;
bool debug;
-
-public:
- S2WasmBuilder(AllocatingModule& wasm, const char* input, bool debug, size_t globalBase)
- : wasm(wasm), allocator(wasm.allocator), debug(debug), globalBase(globalBase), nextStatic(globalBase) {
+ bool ignoreUnknownSymbols;
+
+ public:
+ S2WasmBuilder(AllocatingModule& wasm, const char* input, bool debug,
+ size_t globalBase, bool ignoreUnknownSymbols)
+ : wasm(wasm),
+ allocator(wasm.allocator),
+ debug(debug),
+ ignoreUnknownSymbols(ignoreUnknownSymbols),
+ globalBase(globalBase),
+ nextStatic(globalBase) {
s = input;
scan();
s = input;
@@ -50,7 +57,7 @@ public:
fix();
}
-private:
+ private:
// state
size_t globalBase, // where globals can start to be statically allocated, i.e., the data segment
@@ -1156,7 +1163,7 @@ private:
// must be a function address
if (wasm.functionsMap.count(name) == 0) {
std::cerr << "Unknown symbol: " << name << '\n';
- abort();
+ if (!ignoreUnknownSymbols) abort();
}
ensureFunctionIndex(name);
*(relocation.data) = functionIndexes[name] + relocation.offset;