diff --git a/CMakeLists.txt b/CMakeLists.txt index b4136d3e9..03d7cb4ac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -223,6 +223,15 @@ if(MSVC) endif() +# Default symbol visibility to hidden, that way we don't go through the PLT for intra-library calls. +set(CMAKE_C_VISIBILITY_PRESET hidden) +set(CMAKE_CXX_VISIBILITY_PRESET hidden) +if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-semantic-interposition") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-semantic-interposition") +endif() + + # Detect C++ version support. set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON)