Skip to content

Commit 567e4c0

Browse files
committed
Revert "Try to use a linker script to export symbols from shared library"
This reverts commit 40e0d54.
1 parent c7b3299 commit 567e4c0

File tree

4 files changed

+69
-73
lines changed

4 files changed

+69
-73
lines changed

.github/workflows/MacOS.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,8 @@ jobs:
389389
-DLLVM_ENABLE_WERROR=On \
390390
../
391391
fi
392-
cmake --build . --target check-cppinterop --parallel ${{ env.ncpus }}
392+
cmake --build . --target check-cppinterop --parallel ${{ env.ncpus }} || true
393+
cat /Users/runner/work/CppInterOp/CppInterOp/build/unittests/googletest-prefix/src/googletest-stamp/googletest-build-*.log
393394
cd ..
394395
# We need CB_PYTHON_DIR later
395396
echo "CB_PYTHON_DIR=$CB_PYTHON_DIR" >> $GITHUB_ENV

lib/Interpreter/CMakeLists.txt

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

117117
if(EMSCRIPTEN)
118-
# Specify the path to your linker script
119-
set(LINKER_SCRIPT_PATH "${CMAKE_SOURCE_DIR}/lib/Interpreter/exports.ld")
118+
# Read the undefined symbols from the text file
119+
file(READ "${CMAKE_SOURCE_DIR}/lib/Interpreter/undefined_symbols.txt" SYMBOLS_LIST)
120120

121+
# Replace newlines with spaces
122+
string(REPLACE "\n" " " SYMBOLS_LIST "${SYMBOLS_LIST}")
121123
#FIXME: Setting no_soname=1 is needed until https://github.com/emscripten-core/emscripten/blob/ac676d5e437525d15df5fd46bc2c208ec6d376a3/cmake/Modules/Platform/Emscripten.cmake#L36
122124
# 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
123125
#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
@@ -126,14 +128,10 @@ if(EMSCRIPTEN)
126128
set_target_properties(clangCppInterOp PROPERTIES
127129
NO_SONAME 1
128130
COMPILE_FLAGS "-s SIDE_MODULE=1"
129-
LINK_FLAGS "-s WASM_BIGINT -s SIDE_MODULE=1"
131+
LINK_FLAGS "-s WASM_BIGINT -s SIDE_MODULE=1 ${SYMBOLS_LIST}"
130132
SUFFIX ".wasm"
131133
)
132134

133-
target_link_options(clangCppInterOp PRIVATE
134-
-T${LINKER_SCRIPT_PATH}
135-
)
136-
137135
add_custom_command(TARGET clangCppInterOp POST_BUILD
138136
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:clangCppInterOp> ${CMAKE_BINARY_DIR}/unittests/CppInterOp/
139137
)

lib/Interpreter/exports.ld

Lines changed: 0 additions & 65 deletions
This file was deleted.
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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
38+
-Wl,--export=_ZN5clang13MangleContext10mangleNameENS_10GlobalDeclERN4llvm11raw_ostreamE
39+
-Wl,--export=_ZN5clang13MangleContext20shouldMangleDeclNameEPKNS_9NamedDeclE
40+
-Wl,--export=_ZN5clang26IncrementalCompilerBuilder9CreateCppEv
41+
-Wl,--export=_ZN5clang4Decl17castToDeclContextEPKS0_
42+
-Wl,--export=_ZNK3Cpp7JitCall17AreArgumentsValidEPvNS0_7ArgListES1_
43+
-Wl,--export=_ZNK3Cpp7JitCall17ReportInvokeStartEPvNS0_7ArgListES1_
44+
-Wl,--export=_ZNK3Cpp7JitCall17ReportInvokeStartEPvmi
45+
-Wl,--export=_ZNK4llvm5APInt13compareSignedERKS0_
46+
-Wl,--export=_ZNK4llvm5APInt4sextEj
47+
-Wl,--export=_ZNK4llvm5APInt4zextEj
48+
-Wl,--export=_ZNK4llvm5APInt7compareERKS0_
49+
-Wl,--export=_ZNK4llvm5Error19fatalUncheckedErrorEv
50+
-Wl,--export=_ZNK5clang10ASTContext14getComplexTypeENS_8QualTypeE
51+
-Wl,--export=_ZNK5clang10ASTContext19getTypeDeclTypeSlowEPKNS_8TypeDeclE
52+
-Wl,--export=_ZNK5clang10RecordDecl19isInjectedClassNameEv
53+
-Wl,--export=_ZNK5clang11DeclContext11decls_beginEv
54+
-Wl,--export=_ZNK5clang11DeclContext6lookupENS_15DeclarationNameE
55+
-Wl,--export=_ZNK5clang12FunctionDecl29getTemplateSpecializationArgsEv
56+
-Wl,--export=_ZNK5clang12FunctionDecl31getTemplateInstantiationPatternEb
57+
-Wl,--export=_ZNK5clang17ClassTemplateDecl18getSpecializationsEv
58+
-Wl,--export=_ZNK5clang29VarTemplateSpecializationDecl22getSpecializedTemplateEv
59+
-Wl,--export=_ZNK5clang4Decl13getASTContextEv
60+
-Wl,--export=_ZNK5clang4Decl15hasDefiningAttrEv
61+
-Wl,--export=_ZNK5clang4Decl8getAttrsEv
62+
-Wl,--export=_ZN4llvm3sys2fs6accessERKNS_5TwineENS1_10AccessModeE

0 commit comments

Comments
 (0)