diff -rauN mariadb-10.6.5/mysys/CMakeLists.txt mariadb-10.6.5-atomic-patch/mysys/CMakeLists.txt
--- mariadb-10.6.5/mysys/CMakeLists.txt	2021-11-05 21:03:30.000000000 +0100
+++ mariadb-10.6.5-atomic-patch/mysys/CMakeLists.txt	2021-12-05 14:25:31.517929493 +0100
@@ -186,6 +186,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.6.5/storage/rocksdb/build_rocksdb.cmake mariadb-10.6.5-atomic-patch/storage/rocksdb/build_rocksdb.cmake
--- mariadb-10.6.5/storage/rocksdb/build_rocksdb.cmake	2021-11-05 21:03:31.000000000 +0100
+++ mariadb-10.6.5-atomic-patch/storage/rocksdb/build_rocksdb.cmake	2021-12-05 14:25:31.517929493 +0100
@@ -494,6 +494,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()