MDEV-26541 Make UBSAN builds work with spider again.

When built with ubsan and trying to load the spider plugin, the hidden
visibility of mysqld compiling flag causes ha_spider.so to be missing
the symbol ha_partition. This commit fixes that, as well as some
memcpy null pointer issues when built with ubsan.

Signed-off-by: Yuchen Pei <yuchen.pei@mariadb.com>
This commit is contained in:
Yuchen Pei 2023-01-12 13:41:49 +11:00
commit a68b9dd993
No known key found for this signature in database
GPG key ID: 3DD1B35105743563
5 changed files with 215 additions and 107 deletions

View file

@ -197,6 +197,15 @@ FOREACH(se aria partition perfschema sql_sequence wsrep)
ENDIF()
ENDFOREACH()
IF(VISIBILITY_HIDDEN_FLAG AND TARGET partition AND WITH_UBSAN)
# the spider plugin needs some partition symbols from inside mysqld
# when built with ubsan, in which case we need to remove
# -fvisibility=hidden from partition
GET_TARGET_PROPERTY(f partition COMPILE_FLAGS)
STRING(REPLACE "${VISIBILITY_HIDDEN_FLAG}" "" f ${f})
SET_TARGET_PROPERTIES(partition PROPERTIES COMPILE_FLAGS "${f}")
ENDIF()
IF(WIN32)
SET(MYSQLD_SOURCE main.cc nt_servc.cc message.rc)
TARGET_LINK_LIBRARIES(sql psapi)