summaryrefslogtreecommitdiff
path: root/cmake/dtrace.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/dtrace.cmake')
-rw-r--r--cmake/dtrace.cmake25
1 files changed, 23 insertions, 2 deletions
diff --git a/cmake/dtrace.cmake b/cmake/dtrace.cmake
index f110e2ab32c..d5566d03913 100644
--- a/cmake/dtrace.cmake
+++ b/cmake/dtrace.cmake
@@ -72,8 +72,29 @@ IF(ENABLE_DTRACE)
)
ENDIF()
+IF(CMAKE_SYSTEM_NAME MATCHES "SunOS" AND CMAKE_COMPILER_IS_GNUCXX
+ AND CMAKE_SIZEOF_VOID_P EQUAL 4)
+ IF(NOT DEFINED BUGGY_GCC_NO_DTRACE_MODULES)
+ EXECUTE_PROCESS(
+ COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1} --version
+ OUTPUT_VARIABLE out)
+ IF(out MATCHES "3.4.6")
+ # This gcc causes crashes in dlopen() for dtraced shared libs,
+ # while standard shipped with Solaris10 3.4.3 is ok
+ SET(BUGGY_GCC_NO_DTRACE_MODULES 1 CACHE INTERNAL "")
+ ELSE()
+ SET(BUGGY_GCC_NO_DTRACE_MODULES 0 CACHE INTERNAL "")
+ ENDIF()
+ ENDIF()
+ENDIF()
-MACRO(DTRACE_INSTRUMENT target)
+FUNCTION(DTRACE_INSTRUMENT target)
+ IF(BUGGY_GCC_NO_DTRACE_MODULES)
+ GET_TARGET_PROPERTY(target_type ${target} TYPE)
+ IF(target_type MATCHES "MODULE_LIBRARY")
+ RETURN()
+ ENDIF()
+ ENDIF()
IF(ENABLE_DTRACE)
ADD_DEPENDENCIES(${target} gen_dtrace_header)
@@ -119,7 +140,7 @@ MACRO(DTRACE_INSTRUMENT target)
ENDIF()
ENDIF()
ENDIF()
-ENDMACRO()
+ENDFUNCTION()
# Ugly workaround for Solaris' DTrace inability to use probes