diff --git a/CMakeLists.txt b/CMakeLists.txt index 5d1aa034d..cb2d8b313 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -106,6 +106,9 @@ include(GNUInstallDirs) if (CPPINTEROP_USE_CLING) message(STATUS "Mode CPPINTEROP_USE_CLING = ON") find_package(LLVM REQUIRED CONFIG ${llvm_search_hints} NO_DEFAULT_PATH) + if(EMSCRIPTEN) + find_package(LLD REQUIRED CONFIG ${lld_search_hints} NO_DEFAULT_PATH) + endif() find_package(Clang REQUIRED CONFIG ${clang_search_hints} NO_DEFAULT_PATH) find_package(Cling REQUIRED CONFIG ${cling_search_hints} NO_DEFAULT_PATH) endif(CPPINTEROP_USE_CLING) diff --git a/lib/CppInterOp/CMakeLists.txt b/lib/CppInterOp/CMakeLists.txt index 41288fb60..1267298c3 100644 --- a/lib/CppInterOp/CMakeLists.txt +++ b/lib/CppInterOp/CMakeLists.txt @@ -122,7 +122,11 @@ if(EMSCRIPTEN) # unit tests main_module you get errors due to undefined symbols. The reading of the file # below into a SYMBOLS_LIST variable is a temporary workaround that exports the undefined # symbols from the shared library, until it can be determined why they are not being exported already. - file(READ "${CMAKE_CURRENT_SOURCE_DIR}/exports.ld" SYMBOLS_LIST) + if (CPPINTEROP_USE_CLING) + file(READ "${CMAKE_CURRENT_SOURCE_DIR}/cling-exports.ld" SYMBOLS_LIST) + else() + file(READ "${CMAKE_CURRENT_SOURCE_DIR}/exports.ld" SYMBOLS_LIST) + endif() # Replace newlines with spaces string(REPLACE "\n" " " SYMBOLS_LIST "${SYMBOLS_LIST}") diff --git a/lib/CppInterOp/cling-exports.ld b/lib/CppInterOp/cling-exports.ld new file mode 100644 index 000000000..488b6b58c --- /dev/null +++ b/lib/CppInterOp/cling-exports.ld @@ -0,0 +1,33 @@ +-Wl,--export=_ZN4llvm13StringMapImpl11RehashTableEj +-Wl,--export=_ZN4llvm13StringMapImpl15LookupBucketForENS_9StringRefEj +-Wl,--export=_ZN4llvm13StringMapImpl4hashENS_9StringRefE +-Wl,--export=_ZN4llvm15SmallVectorBaseIjE8grow_podEPvmm +-Wl,--export=_ZN4llvm15allocate_bufferEmm +-Wl,--export=_ZN4llvm3sys17RunningOnValgrindEv +-Wl,--export=_ZN4llvm5APIntC1EjNS_8ArrayRefIyEE +-Wl,--export=_ZN5clang11DeclContext7classofEPKNS_4DeclE +-Wl,--export=_ZN5clang4Decl17castToDeclContextEPKS0_ +-Wl,--export=_ZNK4llvm5APInt13compareSignedERKS0_ +-Wl,--export=_ZNK4llvm5APInt4sextEj +-Wl,--export=_ZNK4llvm5APInt4zextEj +-Wl,--export=_ZNK4llvm5APInt7compareERKS0_ +-Wl,--export=_ZNK5clang10ASTContext14getComplexTypeENS_8QualTypeE +-Wl,--export=_ZNK5clang10ASTContext19getTypeDeclTypeSlowEPKNS_8TypeDeclE +-Wl,--export=_ZNK5clang10ASTContext22getLValueReferenceTypeENS_8QualTypeEb +-Wl,--export=_ZNK5clang10RecordDecl19isInjectedClassNameEv +-Wl,--export=_ZNK5clang11DeclContext11decls_beginEv +-Wl,--export=_ZNK5clang11DeclContext6lookupENS_15DeclarationNameE +-Wl,--export=_ZNK5clang12FunctionDecl12getNumParamsEv +-Wl,--export=_ZNK5clang12FunctionDecl29getTemplateSpecializationArgsEv +-Wl,--export=_ZNK5clang12FunctionDecl31getTemplateInstantiationPatternEb +-Wl,--export=_ZNK5clang17ClassTemplateDecl18getSpecializationsEv +-Wl,--export=_ZNK5clang29VarTemplateSpecializationDecl22getSpecializedTemplateEv +-Wl,--export=_ZNK5clang4Decl13getASTContextEv +-Wl,--export=_ZNK5clang4Decl15hasDefiningAttrEv +-Wl,--export=_ZNK5clang4Sema15getStdNamespaceEv +-Wl,--export=_ZNK5clang4Type14isFloatingTypeEv +-Wl,--export=_ZNK5clang4Type27getUnqualifiedDesugaredTypeEv +-Wl,--export=_ZNK5clang7TagType7getDeclEv +-Wl,--export=_ZNK5clang7VarDecl28isThisDeclarationADefinitionERNS_10ASTContextE +-Wl,--export=_ZN4llvm3sys2fs17getMainExecutableEPKcPv +-Wl,--export=_ZN4llvm3sys4path6appendERNS_15SmallVectorImplIcEERKNS_5TwineES7_S7_S7_