Commit 46800354 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

Workaround crash with dtraced shared libraries under GCC 3.4.6 on 32 bit Solaris.

Crash happens in dlopen() code when trying to load the library. Crash does not happen when library is 
not DTrace instrumented . Additionally, crash does not happen with default Solaris 10 GCC 3.4.3 and
it does not happen if main executable is instrumented.

So , just check for this specific situation (32 bit, GCC3.4.6 , Solaris) and disable Dtrace in shared libraries.
We have only single plugin so far that is instrumented (ha_example)
parent 527ff458
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment