diff options
author | Jose Fonseca <jfonseca@vmware.com> | 2016-04-16 15:08:43 +0100 |
---|---|---|
committer | Jose Fonseca <jfonseca@vmware.com> | 2016-04-16 15:08:43 +0100 |
commit | 49dfaaf14098fedd6b3791a0ef2ad32b9291bcf8 (patch) | |
tree | 34b8f90fa7c9003dbf30d4f0ff03495bfdbb9a17 /wrappers | |
parent | a7caf011c7ae5a6d8fd65165db0e1b1c62851659 (diff) |
cmake: Add option to build with Address Sanitizer.
Also remove SSP: it was only being used in Debug builds, and it never
found a bug.
Diffstat (limited to 'wrappers')
-rw-r--r-- | wrappers/CMakeLists.txt | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/wrappers/CMakeLists.txt b/wrappers/CMakeLists.txt index 4a3f7e34..2f0d1cf4 100644 --- a/wrappers/CMakeLists.txt +++ b/wrappers/CMakeLists.txt @@ -56,6 +56,21 @@ include_directories ( ${CMAKE_SOURCE_DIR}/guids ) +if (NOT WIN32 AND NOT APPLE) + # Prevent symbol relocations internal to our wrapper library to be + # overwritten by the application. And fail if there are missing + # symbols. + set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-Bsymbolic -Wl,-Bsymbolic-functions") + set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-Bsymbolic -Wl,-Bsymbolic-functions") + + # Fail if there are missing symbols, except when using Address Sanitizer + # since libasan symbols are supposed to be preloaded. + if (NOT ENABLE_ASAN) + set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,defs") + set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-z,defs") + endif () +endif () + set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) add_convenience_library (trace @@ -351,10 +366,6 @@ elseif (X11_FOUND) set_target_properties (glxtrace PROPERTIES # avoid the default "lib" prefix PREFIX "" - # Prevent symbol relocations internal to our wrapper library to be - # overwritten by the application. And fail if there are missing - # symbols. - LINK_FLAGS "-Wl,-Bsymbolic -Wl,-Bsymbolic-functions -Wl,-z,defs" ) target_link_libraries (glxtrace @@ -402,10 +413,6 @@ if (ENABLE_EGL AND NOT WIN32 AND NOT APPLE) set_target_properties (egltrace PROPERTIES # avoid the default "lib" prefix PREFIX "" - # Prevent symbol relocations internal to our wrapper library to be - # overwritten by the application. And fail if there are missing - # symbols. - LINK_FLAGS "-Wl,-Bsymbolic -Wl,-Bsymbolic-functions -Wl,-z,defs" ) target_link_libraries (egltrace |