summaryrefslogtreecommitdiff
path: root/src/wasm-linker.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm-linker.h')
-rw-r--r--src/wasm-linker.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/wasm-linker.h b/src/wasm-linker.h
index 701585190..3f1e8c7ac 100644
--- a/src/wasm-linker.h
+++ b/src/wasm-linker.h
@@ -252,6 +252,9 @@ class Linker {
// Returns false if an error occurred.
bool linkArchive(Archive& archive);
+ // Name of the dummy function to prevent erroneous nullptr comparisons.
+ static constexpr const char* dummyFunction = "__wasm_nullptr";
+
private:
// Allocate a static variable and return its address in linear memory
Address allocateStatic(Address allocSize, Address alignment, Name name) {
@@ -279,6 +282,14 @@ class Linker {
void ensureImport(Name target, std::string signature);
+ // Retrieves (and assigns) an entry index in the indirect function table for
+ // a given function.
+ Index getFunctionIndex(Name name);
+
+ // Adds a dummy function in the indirect table at slot 0 to prevent NULL
+ // pointer miscomparisons.
+ void makeDummyFunction();
+
// Create thunks for use with emscripten Runtime.dynCall. Creates one for each
// signature in the indirect function table.
void makeDynCallThunks();