summaryrefslogtreecommitdiff
path: root/cmake/dtrace.cmake
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@sol>2009-12-11 18:33:00 +0000
committerVladislav Vaintroub <wlad@sol>2009-12-11 18:33:00 +0000
commit3a6b75949c44709fec9841a3b216dec2f46826e1 (patch)
treea7d5625c5003cd5f0091afebc7934a0260ad1e71 /cmake/dtrace.cmake
parent55ccb35ba66e4e9168c412c95ebbb85106db8b2c (diff)
downloadmariadb-git-3a6b75949c44709fec9841a3b216dec2f46826e1.tar.gz
Introduce macro DTRACE_INSTRUMENT_STATIC_LIBS,to hide
the ugly Solaris dtrace workarounds
Diffstat (limited to 'cmake/dtrace.cmake')
-rw-r--r--cmake/dtrace.cmake35
1 files changed, 33 insertions, 2 deletions
diff --git a/cmake/dtrace.cmake b/cmake/dtrace.cmake
index 960a7aa4c84..653114d4963 100644
--- a/cmake/dtrace.cmake
+++ b/cmake/dtrace.cmake
@@ -103,10 +103,41 @@ MACRO (DTRACE_INSTRUMENT target)
COMMAND ${CMAKE_RANLIB} ${target_location}
)
- # Remember the object directory (it is used to workaround lack of static
- # library support when linking mysqld)
+ # Used in DTRACE_INSTRUMENT_WITH_STATIC_LIBS
SET(TARGET_OBJECT_DIRECTORY_${target} ${objdir} CACHE INTERNAL "")
ENDIF()
ENDIF()
ENDIF()
ENDMACRO()
+
+
+# Ugly workaround for Solaris' DTrace inability to use probes
+# from static libraries, discussed e.g in this thread
+# (http://opensolaris.org/jive/thread.jspa?messageID=432454)
+# We have to collect all object files that may be instrumented
+# and go into the mysqld (also those that come from in static libs)
+# run them again through dtrace -G to generate an ELF file that links
+# to mysqld.
+MACRO (DTRACE_INSTRUMENT_STATIC_LIBS target libs)
+IF(CMAKE_SYSTEM_NAME MATCHES "SunOS" AND ENABLE_DTRACE)
+ FOREACH(lib ${libs})
+ SET(dirs ${dirs} ${TARGET_OBJECT_DIRECTORY_${lib}})
+ ENDFOREACH()
+ SET (obj ${CMAKE_BINARY_DIR}/${target}_dtrace_all.o)
+ ADD_CUSTOM_COMMAND(
+ OUTPUT ${obj}
+ DEPENDS ${libs}
+ COMMAND ${CMAKE_COMMAND}
+ -DDTRACE=${DTRACE}
+ -DOUTFILE=${obj}
+ -DDFILE=${CMAKE_BINARY_DIR}/include/probes_mysql.d
+ -DDTRACE_FLAGS=${DTRACE_FLAGS}
+ "-DDIRS=${dirs}"
+ -P ${CMAKE_SOURCE_DIR}/cmake/dtrace_prelink.cmake
+ VERBATIM
+ )
+ ADD_CUSTOM_TARGET(${target}_dtrace_all DEPENDS ${obj})
+ ADD_DEPENDENCIES(${target} ${target}_dtrace_all)
+ TARGET_LINK_LIBRARIES(${target} ${obj})
+ENDIF()
+ENDMACRO()