Add linker version script to explicitly expose symbols. Refs #683

* When statically linking libstdc++ by default the symbols are all
  default visibility. This causes a problem if you statically link an
  old libstdc++ then inject librenderdoc.so, and the application starts
  using the old libstdc++ instead of the system's.
* Really we only want to use the static one for calls from
  librenderdoc.so. In theory -Wl,--exclude-libs,libstdc++ should do this
  for us, but it starts to cause bizarre crashes.
* Instead, we have to resort to a manual linker script which whitelists
  which symbols should be visible. Normally we can do this just for our
  own symbols with -fvisibility=hidden and __attribute__((visibility))
  but that doesn't work for linked symbols apparently.
This commit is contained in:
baldurk
2017-07-17 16:22:00 +01:00
parent 2f6dffffc5
commit 389cff23f3
2 changed files with 16 additions and 0 deletions
+4
View File
@@ -307,6 +307,10 @@ target_compile_definitions(renderdoc ${RDOC_DEFINITIONS})
target_include_directories(renderdoc ${RDOC_INCLUDES})
target_link_libraries(renderdoc ${RDOC_LIBRARIES})
if(UNIX AND NOT ANDROID)
set_target_properties(renderdoc PROPERTIES LINK_FLAGS "-Wl,--version-script,${CMAKE_CURRENT_SOURCE_DIR}/renderdoc.version")
endif()
install (TARGETS renderdoc DESTINATION lib${LIB_SUFFIX})
# Copy in application API header to include
+12
View File
@@ -0,0 +1,12 @@
{
global:
_init;
_fini;
gl[A-Z]*;
dlopen;
_exit;
RENDERDOC_*;
VK_LAYER_RENDERDOC_*;
local:
*;
};