diff options
Diffstat (limited to 'src/wasm-linker.h')
-rw-r--r-- | src/wasm-linker.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/wasm-linker.h b/src/wasm-linker.h index 5fe01b393..a0684d02b 100644 --- a/src/wasm-linker.h +++ b/src/wasm-linker.h @@ -119,6 +119,15 @@ class LinkerObject { undefinedFunctionCalls[call->target].push_back(call); } + void addExternType(Name name, FunctionType* ty) { + externTypesMap[name] = ty; + } + FunctionType* getExternType(Name name) { + auto f = externTypesMap.find(name); + if (f == externTypesMap.end()) return nullptr; + return f->second; + } + bool isEmpty() { return wasm.functions.empty(); } @@ -146,6 +155,9 @@ class LinkerObject { using CallList = std::vector<Call*>; std::map<Name, CallList> undefinedFunctionCalls; + // Types of functions which are declared but not defined. + std::unordered_map<cashew::IString, FunctionType*> externTypesMap; + std::map<Name, Address> segments; // name => segment index (in wasm module) std::vector<Name> initializerFunctions; @@ -244,6 +256,8 @@ class Linker { o << "]"; } + void ensureImport(Name target, std::string signature); + // Create thunks for use with emscripten Runtime.dynCall. Creates one for each // signature in the indirect function table. void makeDynCallThunks(); @@ -263,6 +277,8 @@ class Linker { out.wasm.addExport(exp); } + Function* generateImportThunk(Name name, const FunctionType* t); + // The output module (linked executable) LinkerObject out; |