2019-07-19 19:38:09 +02:00
|
|
|
Author: Vicențiu Ciorbaru <vicentiu@mariadb.org>
|
|
|
|
Date: Fri Dec 21 19:14:04 2018 +0200
|
|
|
|
|
|
|
|
Link with libatomic to enable C11 atomics support
|
|
|
|
|
|
|
|
Some architectures (mips) require libatomic to support proper
|
|
|
|
atomic operations. Check first if support is available without
|
|
|
|
linking, otherwise use the library.
|
|
|
|
|
2021-03-15 23:23:34 +01:00
|
|
|
Index: mariadb-10.5.9/configure.cmake
|
2020-11-18 10:22:33 +01:00
|
|
|
===================================================================
|
2021-03-15 23:23:34 +01:00
|
|
|
--- mariadb-10.5.9.orig/configure.cmake
|
|
|
|
+++ mariadb-10.5.9/configure.cmake
|
|
|
|
@@ -862,7 +862,25 @@ int main()
|
2019-07-19 19:38:09 +02:00
|
|
|
long long int *ptr= &var;
|
|
|
|
return (int)__atomic_load_n(ptr, __ATOMIC_SEQ_CST);
|
|
|
|
}"
|
|
|
|
-HAVE_GCC_C11_ATOMICS)
|
|
|
|
+HAVE_GCC_C11_ATOMICS_WITHOUT_LIBATOMIC)
|
|
|
|
+IF (HAVE_GCC_C11_ATOMICS_WITHOUT_LIBATOMIC)
|
|
|
|
+ SET(HAVE_GCC_C11_ATOMICS True)
|
|
|
|
+ELSE()
|
|
|
|
+ SET(OLD_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
|
|
|
|
+ LIST(APPEND CMAKE_REQUIRED_LIBRARIES "atomic")
|
2018-12-04 09:15:12 +01:00
|
|
|
+ CHECK_CXX_SOURCE_COMPILES("
|
2019-07-19 19:38:09 +02:00
|
|
|
+ int main()
|
|
|
|
+ {
|
|
|
|
+ long long int var= 1;
|
|
|
|
+ long long int *ptr= &var;
|
|
|
|
+ return (int)__atomic_load_n(ptr, __ATOMIC_SEQ_CST);
|
|
|
|
+ }"
|
|
|
|
+ HAVE_GCC_C11_ATOMICS_WITH_LIBATOMIC)
|
|
|
|
+ IF(HAVE_GCC_C11_ATOMICS_WITH_LIBATOMIC)
|
|
|
|
+ SET(HAVE_GCC_C11_ATOMICS True)
|
|
|
|
+ ENDIF()
|
|
|
|
+ SET(CMAKE_REQUIRED_LIBRARIES ${OLD_CMAKE_REQUIRED_LIBRARIES})
|
|
|
|
+ENDIF()
|
|
|
|
|
|
|
|
IF(WITH_VALGRIND)
|
|
|
|
SET(HAVE_valgrind 1)
|
2021-03-15 23:23:34 +01:00
|
|
|
Index: mariadb-10.5.9/mysys/CMakeLists.txt
|
2020-11-18 10:22:33 +01:00
|
|
|
===================================================================
|
2021-03-15 23:23:34 +01:00
|
|
|
--- mariadb-10.5.9.orig/mysys/CMakeLists.txt
|
|
|
|
+++ mariadb-10.5.9/mysys/CMakeLists.txt
|
|
|
|
@@ -154,6 +154,10 @@ TARGET_LINK_LIBRARIES(mysys dbug strings
|
2020-11-18 10:22:33 +01:00
|
|
|
${LIBNSL} ${LIBM} ${LIBRT} ${CMAKE_DL_LIBS} ${LIBSOCKET} ${LIBEXECINFO})
|
2019-07-19 19:38:09 +02:00
|
|
|
DTRACE_INSTRUMENT(mysys)
|
|
|
|
|
|
|
|
+IF (HAVE_GCC_C11_ATOMICS_WITH_LIBATOMIC)
|
|
|
|
+ TARGET_LINK_LIBRARIES(mysys atomic)
|
|
|
|
+ENDIF()
|
2018-12-04 09:15:12 +01:00
|
|
|
+
|
2019-07-19 19:38:09 +02:00
|
|
|
IF(HAVE_BFD_H)
|
|
|
|
TARGET_LINK_LIBRARIES(mysys bfd)
|
|
|
|
ENDIF(HAVE_BFD_H)
|
2021-03-15 23:23:34 +01:00
|
|
|
Index: mariadb-10.5.9/sql/CMakeLists.txt
|
2020-11-18 10:22:33 +01:00
|
|
|
===================================================================
|
2021-03-15 23:23:34 +01:00
|
|
|
--- mariadb-10.5.9.orig/sql/CMakeLists.txt
|
|
|
|
+++ mariadb-10.5.9/sql/CMakeLists.txt
|
|
|
|
@@ -222,6 +222,10 @@ ELSE()
|
2019-07-19 19:38:09 +02:00
|
|
|
SET(MYSQLD_SOURCE main.cc ${DTRACE_PROBES_ALL})
|
2018-12-04 09:15:12 +01:00
|
|
|
ENDIF()
|
|
|
|
|
2019-07-19 19:38:09 +02:00
|
|
|
+IF (HAVE_GCC_C11_ATOMICS_WITH_LIBATOMIC)
|
|
|
|
+ TARGET_LINK_LIBRARIES(sql atomic)
|
|
|
|
+ENDIF()
|
|
|
|
+
|
2021-03-15 23:23:34 +01:00
|
|
|
IF(MSVC OR CMAKE_SYSTEM_NAME MATCHES AIX)
|
2020-10-22 00:25:44 +02:00
|
|
|
SET(libs_to_export_symbols sql mysys dbug strings)
|
|
|
|
# Create shared library of already compiled object
|