Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions core/metacling/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,17 @@ if(NOT APPLE AND NOT MSVC)
# and by ALICE in https://github.com/root-project/root/issues/19889
# Only needed for Linux: Mac uses linker namespaces and Windows explicit export/import
target_link_libraries(Cling PRIVATE -Wl,-Bsymbolic)
# We compile with -fvisibility=hidden in interpreter/, but some symbols of
# instantiated templates remain. Use a version script to hide them.
target_link_libraries(Cling PRIVATE -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/libCling.script)
set_target_properties(Cling PROPERTIES LINK_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libCling.script)
# After inlining and hiding symbols, some of them are not referenced anymore
# and can be collected by the linker, reducing the library size.
target_link_libraries(Cling PRIVATE -Wl,--gc-sections)
# Additionally, for Release builds, strip the binary to remove symbol tables.
add_custom_command(TARGET Cling POST_BUILD
COMMAND $<$<CONFIG:Release>:${CMAKE_STRIP}>
ARGS $<TARGET_FILE:Cling>)
endif()

if (CMAKE_SYSTEM_NAME MATCHES FreeBSD)
Expand Down
Loading