Skip to content

Commit dc3eb1d

Browse files
authored
Input undefined symbols wasm as a list
1 parent d04f744 commit dc3eb1d

File tree

2 files changed

+43
-2
lines changed

2 files changed

+43
-2
lines changed

lib/Interpreter/CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,11 @@ endif()
115115
)
116116

117117
if(EMSCRIPTEN)
118-
118+
# Read the undefined symbols from the text file
119+
file(READ "${CMAKE_SOURCE_DIR}/lib/Interpreter/undefined_symbols.txt" SYMBOLS_LIST)
120+
121+
# Replace newlines with spaces
122+
string(REPLACE "\n" " " SYMBOLS_LIST "${SYMBOLS_LIST}")
119123
#FIXME: Setting no_soname=1 is needed until https://github.com/emscripten-core/emscripten/blob/ac676d5e437525d15df5fd46bc2c208ec6d376a3/cmake/Modules/Platform/Emscripten.cmake#L36
120124
# is patched out of emsdk, as --soname is not recognised by emscripten. A PR to do this has been done here https://github.com/emscripten-core/emscripten/pull/23453
121125
#FIXME: A patch is needed to llvm to remove -Wl,-z,defs since it is now recognised on emscripten. What needs to be removed is here
@@ -124,7 +128,7 @@ if(EMSCRIPTEN)
124128
set_target_properties(clangCppInterOp PROPERTIES
125129
NO_SONAME 1
126130
COMPILE_FLAGS "-s SIDE_MODULE=1"
127-
LINK_FLAGS "-s WASM_BIGINT -s SIDE_MODULE=1 -Wl,--export=_ZN4llvm3sys2fs17getMainExecutableEPKcPv -Wl,--export=_ZN4llvm3sys4path11parent_pathENS_9StringRefENS1_5StyleE -Wl,--export=__ZN3Cpp11GetOperatorEPvNS_8OperatorERNSt3__26vectorIS0_NS2_9allocatorIS0_EEEENS_13OperatorArityE"
131+
LINK_FLAGS "-s WASM_BIGINT -s SIDE_MODULE=1 ${SYMBOLS_LIST}"
128132
SUFFIX ".wasm"
129133
)
130134

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
-Wl,--export=_ZN4llvm3sys2fs17getMainExecutableEPKcPv
2+
-Wl,--export=_ZN4llvm3sys4path11parent_pathENS_9StringRefENS1_5StyleE
3+
-Wl,--export=_ZN3Cpp11GetOperatorEPvNS_8OperatorERNSt3__26vectorIS0_NS2_9allocatorIS0_EEEENS_13OperatorArityE
4+
-Wl,--export=_ZN4llvm11raw_ostream14flush_nonemptyEv
5+
-Wl,--export=_ZN4llvm11raw_ostream16SetBufferAndModeEPcmNS0_10BufferKindE
6+
-Wl,--export=_ZN4llvm11raw_ostream5writeEPKcm
7+
-Wl,--export=_ZN4llvm11raw_ostreamD2Ev
8+
-Wl,--export=_ZN4llvm13StringMapImpl11RehashTableEj
9+
-Wl,--export=_ZN4llvm13StringMapImpl15LookupBucketForENS_9StringRefEj
10+
-Wl,--export=_ZN4llvm13StringMapImpl4hashENS_9StringRefE
11+
-Wl,--export=_ZN4llvm15SmallVectorBaseIjE8grow_podEPvmm
12+
-Wl,--export=_ZN4llvm15allocate_bufferEmm
13+
-Wl,--export=_ZN4llvm21logAllUnhandledErrorsENS_5ErrorERNS_11raw_ostreamENS_5TwineE
14+
-Wl,--export=_ZN4llvm25llvm_unreachable_internalEPKcS1_j
15+
-Wl,--export=_ZN4llvm3sys17RunningOnValgrindEv
16+
-Wl,--export=_ZN4llvm3sys4path6appendERNS_15SmallVectorImplIcEERKNS_5TwineES7_S7_S7_
17+
-Wl,--export=_ZN4llvm4dbgsEv
18+
-Wl,--export=_ZN4llvm4errsEv
19+
-Wl,--export=_ZN4llvm5APIntC1EjNS_8ArrayRefIyEE
20+
-Wl,--export=_ZN5clang10ASTContext19createMangleContextEPKNS_10TargetInfoE
21+
-Wl,--export=_ZN5clang11DeclContext7classofEPKNS_4DeclE
22+
-Wl,--export=_ZN5clang11Interpreter19getCompilerInstanceEv
23+
-Wl,--export=_ZN5clang11Interpreter5ParseEN4llvm9StringRefE
24+
-Wl,--export=_ZN5clang11Interpreter6createENSt3__210unique_ptrINS_16CompilerInstanceENS1_14default_deleteIS3_EEEE
25+
-Wl,--export=_ZN5clang11Interpreter7ExecuteERNS_22PartialTranslationUnitE
26+
-Wl,--export=_ZNK5clang4Sema15getStdNamespaceEv
27+
-Wl,--export=_ZNK5clang4Type27getUnqualifiedDesugaredTypeEv
28+
-Wl,--export=_ZNK5clang7TagType7getDeclEv
29+
-Wl,--export=_ZNK5clang7VarDecl28isThisDeclarationADefinitionERNS_10ASTContextE
30+
-Wl,--export=_ZTVN4llvm18raw_string_ostreamE
31+
-Wl,--export=clang_Interpreter_dispose
32+
-Wl,--export=clang_Interpreter_getClangInterpreter
33+
-Wl,--export=clang_Interpreter_takeInterpreterAsPtr
34+
-Wl,--export=clang_createInterpreterFromRawPtr
35+
-Wl,--export=clang_getComplexType
36+
-Wl,--export=clang_getTypeAsString
37+
-Wl,--export=clang_instantiateTemplate

0 commit comments

Comments
 (0)