summaryrefslogtreecommitdiff
path: root/extra/mariadb/mariadb-10.6.5-atomic.patch
blob: bd6307a119e0c4503650f94167eb41d0def316a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
diff -rauN mariadb-10.5.10/configure.cmake mariadb-10.5.10-atomic-patch/configure.cmake
--- mariadb-10.5.10/configure.cmake	2021-05-05 23:00:18.000000000 +0200
+++ mariadb-10.5.10-atomic-patch/configure.cmake	2021-05-30 13:26:47.387151901 +0200
@@ -865,7 +865,26 @@
   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")
+  CHECK_CXX_SOURCE_COMPILES("
+  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)
diff -rauN mariadb-10.5.10/mysys/CMakeLists.txt mariadb-10.5.10-atomic-patch/mysys/CMakeLists.txt
--- mariadb-10.5.10/mysys/CMakeLists.txt	2021-05-05 23:00:19.000000000 +0200
+++ mariadb-10.5.10-atomic-patch/mysys/CMakeLists.txt	2021-05-30 13:28:17.793904044 +0200
@@ -181,6 +181,11 @@
   TARGET_LINK_LIBRARIES(mysys pthread)
 ENDIF()
 
+# Explicit libatomic for i486
+IF (HAVE_GCC_C11_ATOMICS_WITH_LIBATOMIC)
+  TARGET_LINK_LIBRARIES(mysys atomic)
+ENDIF()
+
 ADD_EXECUTABLE(thr_lock thr_lock.c)
 TARGET_LINK_LIBRARIES(thr_lock mysys)
 SET_TARGET_PROPERTIES(thr_lock PROPERTIES COMPILE_FLAGS "-DMAIN")
diff -rauN mariadb-10.5.10/storage/rocksdb/build_rocksdb.cmake mariadb-10.5.10-atomic-patch/storage/rocksdb/build_rocksdb.cmake
--- mariadb-10.5.10/storage/rocksdb/build_rocksdb.cmake	2021-05-05 23:00:19.000000000 +0200
+++ mariadb-10.5.10-atomic-patch/storage/rocksdb/build_rocksdb.cmake	2021-05-30 13:29:54.193990574 +0200
@@ -498,6 +498,9 @@
 
 ADD_CONVENIENCE_LIBRARY(rocksdblib ${SOURCES})
 target_link_libraries(rocksdblib ${THIRDPARTY_LIBS} ${SYSTEM_LIBS})
+IF (HAVE_GCC_C11_ATOMICS_WITH_LIBATOMIC)
+  TARGET_LINK_LIBRARIES(rocksdblib atomic)
+ENDIF()
 IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
   set_target_properties(rocksdblib PROPERTIES COMPILE_FLAGS "-fPIC -fno-builtin-memcmp -Wno-error")
 endif()