Skip to content

Commit 1114df8

Browse files
committed
[core] Use version script to hide symbols in libCling
We already use -fvisibility=hidden and -fvisibility-inlines-hidden to generate symbols that are not exported from the shared object. However, these two options don't apply for non-inline template instantiations, which can still cause problems when a STL container is instantiated with an LLVM type that may change size between LLVM versions. Fixes #19889
1 parent 7a5a5c6 commit 1114df8

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

core/metacling/src/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,8 @@ if(APPLE)
225225
target_link_libraries(Cling PUBLIC -Wl,-w -Wl,-bind_at_load -Wl,-undefined,dynamic_lookup)
226226
elseif(NOT MSVC)
227227
target_link_libraries(Cling PUBLIC -Wl,--unresolved-symbols=ignore-in-object-files)
228+
target_link_libraries(Cling PRIVATE -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/libCling.script)
229+
set_target_properties(Cling PROPERTIES LINK_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libCling.script)
228230
endif()
229231

230232
if (CMAKE_SYSTEM_NAME MATCHES FreeBSD)

core/metacling/src/libCling.script

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
global:
3+
CreateInterpreter;
4+
DestroyInterpreter;
5+
TCling__*;
6+
_Z26TCling__TEST_isInvalidDeclP11ClassInfo_t;
7+
TROOT__*;
8+
ROOT_rootcling_Driver;
9+
_ZN5cling*;
10+
cling_runtime_internal_throwIfInvalidPointer;
11+
local:
12+
*;
13+
};

0 commit comments

Comments
 (0)