From d8751d283c5648417973481c6ffd65292d10e20d Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Thu, 2 Feb 2012 21:12:49 +0100 Subject: [PATCH] MDEV-100 : innodb_plugin tests fail on Solaris. The reason for the failure is that the loaded library has the same exported symbols as the builtin one. So the plugin uses innodb functions e.g srv_boot from mysqld rather than plugin's own. This causes the crash. On Unix systems with gcc4 later this error was so far worked around using GCC's visibility attribute. However, in our case, we're using gcc3. See related MySQL bug http://bugs.mysql.com/bug.php?id=48524 and http://bugs.mysql.com/bug.php?id=52263 The fix is to restrict symbol visibility in the plugin using version script (called map file on Solaris). --- storage/innobase/CMakeLists.txt | 11 ++++++++++- storage/innobase/plugin_exports | 11 +++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 storage/innobase/plugin_exports diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt index e529ecbb7a0..27047c816e6 100644 --- a/storage/innobase/CMakeLists.txt +++ b/storage/innobase/CMakeLists.txt @@ -252,7 +252,16 @@ IF(WITH_INNODB) SET(WITH_INNOBASE_STORAGE_ENGINE TRUE) ENDIF() + +# On solaris, reduce symbol visibility, so loader does not mix +# the same symbols from builtin innodb and from shared one +IF(CMAKE_SYSTEM_NAME MATCHES "SunOS" AND CMAKE_COMPILER_IS_GNUCC) + SET(LINKER_SCRIPT "-Wl,-M${CMAKE_CURRENT_SOURCE_DIR}/plugin_exports") +ELSE() + SET(LINKER_SCRIPT) +ENDIF() + MYSQL_ADD_PLUGIN(innobase ${INNOBASE_SOURCES} STORAGE_ENGINE MODULE_ONLY MODULE_OUTPUT_NAME ha_innodb - LINK_LIBRARIES ${ZLIB_LIBRARY}) + LINK_LIBRARIES ${ZLIB_LIBRARY} ${LINKER_SCRIPT}) diff --git a/storage/innobase/plugin_exports b/storage/innobase/plugin_exports new file mode 100644 index 00000000000..03b8cf8c217 --- /dev/null +++ b/storage/innobase/plugin_exports @@ -0,0 +1,11 @@ +{ + global: + _mysql_plugin_interface_version_; + _mysql_sizeof_struct_st_plugin_; + _mysql_plugin_declarations_; + thd_wait_service; + my_snprintf_service; + thd_alloc_service; + local: + *; +};