
Building with assertions flag (-sAssertions=2) gives me these ``` [ RUN ] InterpreterTest.InstantiateTemplate Aborted(Assertion failed: undefined symbol '__clang_Interpreter_SetValueWithAlloc'. perhaps a side module was not linked in? if this global was expected to arrive from a system library, try to build the MAIN_MODULE with EMCC_FORCE_STDLIBS=1 in the environment) Error in loading dynamic library incr_module_3.wasm: RuntimeError: Aborted(Assertion failed: undefined symbol '__clang_Interpreter_SetValueWithAlloc'. perhaps a side module was not linked in? if this global was expected to arrive from a system library, try to build the MAIN_MODULE with EMCC_FORCE_STDLIBS=1 in the environment) Could not load dynamic lib: incr_module_3.wasm RuntimeError: Aborted(Assertion failed: undefined symbol '__clang_Interpreter_SetValueWithAlloc'. perhaps a side module was not linked in? if this global was expected to arrive from a system library, try to build the MAIN_MODULE with EMCC_FORCE_STDLIBS=1 in the environment) [ RUN ] InterpreterTest.InstantiateTemplate Aborted(Assertion failed: undefined symbol '__clang_Interpreter_SetValueNoAlloc'. perhaps a side module was not linked in? if this global was expected to arrive from a system library, try to build the MAIN_MODULE with EMCC_FORCE_STDLIBS=1 in the environment) Error in loading dynamic library incr_module_3.wasm: RuntimeError: Aborted(Assertion failed: undefined symbol '__clang_Interpreter_SetValueNoAlloc'. perhaps a side module was not linked in? if this global was expected to arrive from a system library, try to build the MAIN_MODULE with EMCC_FORCE_STDLIBS=1 in the environment) Could not load dynamic lib: incr_module_3.wasm RuntimeError: Aborted(Assertion failed: undefined symbol '__clang_Interpreter_SetValueNoAlloc'. perhaps a side module was not linked in? if this global was expected to arrive from a system library, try to build the MAIN_MODULE with EMCC_FORCE_STDLIBS=1 in the environment) [ RUN ] InterpreterTest.InstantiateTemplate Aborted(Assertion failed: undefined symbol '_ZnwmPv26__clang_Interpreter_NewTag'. perhaps a side module was not linked in? if this global was expected to arrive from a system library, try to build the MAIN_MODULE with EMCC_FORCE_STDLIBS=1 in the environment) Error in loading dynamic library incr_module_23.wasm: RuntimeError: Aborted(Assertion failed: undefined symbol '_ZnwmPv26__clang_Interpreter_NewTag'. perhaps a side module was not linked in? if this global was expected to arrive from a system library, try to build the MAIN_MODULE with EMCC_FORCE_STDLIBS=1 in the environment) Could not load dynamic lib: incr_module_23.wasm RuntimeError: Aborted(Assertion failed: undefined symbol '_ZnwmPv26__clang_Interpreter_NewTag'. perhaps a side module was not linked in? if this global was expected to arrive from a system library, try to build the MAIN_MODULE with EMCC_FORCE_STDLIBS=1 in the environment) [ RUN ] InterpreterTest.Value Aborted(Assertion failed: undefined symbol '_Z9getGlobalv'. perhaps a side module was not linked in? if this global was expected to arrive from a system library, try to build the MAIN_MODULE with EMCC_FORCE_STDLIBS=1 in the environment) Error in loading dynamic library incr_module_36.wasm: RuntimeError: Aborted(Assertion failed: undefined symbol '_Z9getGlobalv'. perhaps a side module was not linked in? if this global was expected to arrive from a system library, try to build the MAIN_MODULE with EMCC_FORCE_STDLIBS=1 in the environment) Could not load dynamic lib: incr_module_36.wasm [ RUN ] InterpreterTest.Value Aborted(Assertion failed: undefined symbol '_Z9getGlobalv'. perhaps a side module was not linked in? if this global was expected to arrive from a system library, try to build the MAIN_MODULE with EMCC_FORCE_STDLIBS=1 in the environment) Error in loading dynamic library incr_module_36.wasm: RuntimeError: Aborted(Assertion failed: undefined symbol '_Z9setGlobali'. perhaps a side module was not linked in? if this global was expected to arrive from a system library, try to build the MAIN_MODULE with EMCC_FORCE_STDLIBS=1 in the environment) Could not load dynamic lib: incr_module_36.wasm ``` **So we have some symbols missing here that are needed by the side modules being created here.** First 2 are needed by both tests Last 3 are needed for these lines accordingly in the Value test.dc23869f98/clang/unittests/Interpreter/InterpreterTest.cpp (L355)
dc23869f98/clang/unittests/Interpreter/InterpreterTest.cpp (L364)
dc23869f98/clang/unittests/Interpreter/InterpreterTest.cpp (L365)
Everything should work as expected after this ``` [----------] 9 tests from InterpreterTest [ RUN ] InterpreterTest.Sanity [ OK ] InterpreterTest.Sanity (18 ms) [ RUN ] InterpreterTest.IncrementalInputTopLevelDecls [ OK ] InterpreterTest.IncrementalInputTopLevelDecls (45 ms) [ RUN ] InterpreterTest.Errors [ OK ] InterpreterTest.Errors (29 ms) [ RUN ] InterpreterTest.DeclsAndStatements [ OK ] InterpreterTest.DeclsAndStatements (34 ms) [ RUN ] InterpreterTest.UndoCommand /Users/anutosh491/work/llvm-project/clang/unittests/Interpreter/InterpreterTest.cpp:156: Skipped Test fails for Emscipten builds [ SKIPPED ] InterpreterTest.UndoCommand (0 ms) [ RUN ] InterpreterTest.FindMangledNameSymbol [ OK ] InterpreterTest.FindMangledNameSymbol (85 ms) [ RUN ] InterpreterTest.InstantiateTemplate [ OK ] InterpreterTest.InstantiateTemplate (127 ms) [ RUN ] InterpreterTest.Value [ OK ] InterpreterTest.Value (608 ms) [ RUN ] InterpreterTest.TranslationUnit_CanonicalDecl [ OK ] InterpreterTest.TranslationUnit_CanonicalDecl (64 ms) [----------] 9 tests from InterpreterTest (1014 ms total) ``` This is similar to how we need to take care of some symbols while building side modules during running cppinterop's test suite !
118 lines
3.1 KiB
CMake
118 lines
3.1 KiB
CMake
if(EMSCRIPTEN)
|
|
set(LLVM_COMPONENTS_TO_LINK
|
|
""
|
|
)
|
|
set(LLVM_LIBS_TO_LINK
|
|
""
|
|
)
|
|
set(CLANG_LIBS_TO_LINK
|
|
clangInterpreter
|
|
)
|
|
else()
|
|
set(LLVM_COMPONENTS_TO_LINK
|
|
${LLVM_TARGETS_TO_BUILD}
|
|
Core
|
|
MC
|
|
OrcJIT
|
|
Support
|
|
TargetParser
|
|
)
|
|
set(LLVM_LIBS_TO_LINK
|
|
LLVMTestingSupport
|
|
)
|
|
set(CLANG_LIBS_TO_LINK
|
|
clangAST
|
|
clangBasic
|
|
clangInterpreter
|
|
clangFrontend
|
|
clangSema
|
|
)
|
|
endif()
|
|
|
|
add_distinct_clang_unittest(ClangReplInterpreterTests
|
|
IncrementalCompilerBuilderTest.cpp
|
|
IncrementalProcessingTest.cpp
|
|
InterpreterTest.cpp
|
|
InterpreterExtensionsTest.cpp
|
|
CodeCompletionTest.cpp
|
|
|
|
EXPORT_SYMBOLS
|
|
|
|
CLANG_LIBS
|
|
${CLANG_LIBS_TO_LINK}
|
|
|
|
LINK_LIBS
|
|
${LLVM_LIBS_TO_LINK}
|
|
|
|
LLVM_COMPONENTS
|
|
${LLVM_COMPONENTS_TO_LINK}
|
|
)
|
|
|
|
if(EMSCRIPTEN)
|
|
# Without the above you try to link to LLVMSupport twice, and end
|
|
# up with a duplicate symbol error when creating the main module
|
|
get_target_property(LINKED_LIBS ClangReplInterpreterTests LINK_LIBRARIES)
|
|
list(REMOVE_ITEM LINKED_LIBS LLVMSupport)
|
|
set_target_properties(ClangReplInterpreterTests PROPERTIES LINK_LIBRARIES "${LINKED_LIBS}")
|
|
target_link_options(ClangReplInterpreterTests
|
|
PUBLIC "SHELL: -s MAIN_MODULE=1"
|
|
PUBLIC "SHELL: -s ALLOW_MEMORY_GROWTH=1"
|
|
PUBLIC "SHELL: -s STACK_SIZE=32mb"
|
|
PUBLIC "SHELL: -s INITIAL_MEMORY=128mb"
|
|
PUBLIC "SHELL: --emrun"
|
|
PUBLIC "SHELL: -Wl,--export=__clang_Interpreter_SetValueWithAlloc"
|
|
PUBLIC "SHELL: -Wl,--export=__clang_Interpreter_SetValueNoAlloc"
|
|
PUBLIC "SHELL: -Wl,--export=_ZnwmPv26__clang_Interpreter_NewTag"
|
|
PUBLIC "SHELL: -Wl,--export=_Z9getGlobalv"
|
|
PUBLIC "SHELL: -Wl,--export=_Z9setGlobali"
|
|
)
|
|
set_target_properties(ClangReplInterpreterTests PROPERTIES
|
|
SUFFIX ".html"
|
|
)
|
|
endif()
|
|
|
|
# Exceptions on Windows are not yet supported.
|
|
if(NOT WIN32)
|
|
add_subdirectory(ExceptionTests)
|
|
endif()
|
|
|
|
if(MSVC)
|
|
set_target_properties(ClangReplInterpreterTests PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS 1)
|
|
|
|
# RTTI/C++ symbols
|
|
set(ClangReplInterpreterTests_exports ${ClangReplInterpreterTests_exports} ??_7type_info@@6B@
|
|
?__type_info_root_node@@3U__type_info_node@@A
|
|
?nothrow@std@@3Unothrow_t@1@B
|
|
)
|
|
|
|
# Compiler added symbols for static variables. NOT for VStudio < 2015
|
|
set(ClangReplInterpreterTests_exports ${ClangReplInterpreterTests_exports} _Init_thread_abort _Init_thread_epoch
|
|
_Init_thread_footer _Init_thread_header _tls_index
|
|
)
|
|
|
|
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
|
# new/delete variants needed when linking to static msvc runtime (esp. Debug)
|
|
set(ClangReplInterpreterTests_exports ${ClangReplInterpreterTests_exports}
|
|
??2@YAPEAX_K@Z
|
|
??3@YAXPEAX@Z
|
|
??_U@YAPEAX_K@Z
|
|
??_V@YAXPEAX@Z
|
|
??3@YAXPEAX_K@Z
|
|
)
|
|
else()
|
|
set(ClangReplInterpreterTests_exports ${ClangReplInterpreterTests_exports}
|
|
??2@YAPAXI@Z
|
|
??3@YAXPAX@Z
|
|
??3@YAXPAXI@Z
|
|
??_U@YAPAXI@Z
|
|
??_V@YAXPAX@Z
|
|
??_V@YAXPAXI@Z
|
|
)
|
|
endif()
|
|
|
|
# List to '/EXPORT:sym0 /EXPORT:sym1 /EXPORT:sym2 ...'
|
|
list(TRANSFORM ClangReplInterpreterTests_exports PREPEND "LINKER:/EXPORT:")
|
|
set_property(TARGET ClangReplInterpreterTests APPEND PROPERTY LINK_OPTIONS ${ClangReplInterpreterTests_exports})
|
|
|
|
endif(MSVC)
|