summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2021-10-12 07:47:10 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2021-10-12 07:47:10 +0300
commitebd52051206620a0944ffc084582532c0c394523 (patch)
tree059abd1112dbd6c2e3dd499c119c5d7ae2ecf4f8
parentd8b8258a53b1f9b13e1671a1a9d6eb18f9ffd35d (diff)
downloadmariadb-git-ebd52051206620a0944ffc084582532c0c394523.tar.gz
MDEV-26467 fixup for clang-9 and earlier
Before clang-10, asm goto was not supported, so we must use fetch_or().
-rw-r--r--storage/innobase/include/fil0fil.h5
-rw-r--r--storage/innobase/sync/srw_lock.cc5
2 files changed, 8 insertions, 2 deletions
diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h
index 60f2be95ece..ea18ff7023b 100644
--- a/storage/innobase/include/fil0fil.h
+++ b/storage/innobase/include/fil0fil.h
@@ -1539,7 +1539,10 @@ inline void fil_space_t::reacquire()
inline bool fil_space_t::set_stopping_check()
{
mysql_mutex_assert_owner(&fil_system.mutex);
-#if defined __GNUC__ && (defined __i386__ || defined __x86_64__)
+#if defined __clang_major__ && __clang_major__ < 10
+ /* Only clang-10 introduced support for asm goto */
+ return n_pending.fetch_or(STOPPING, std::memory_order_relaxed) & STOPPING;
+#elif defined __GNUC__ && (defined __i386__ || defined __x86_64__)
static_assert(STOPPING == 1U << 31, "compatibility");
__asm__ goto("lock btsl $31, %0\t\njnc %l1" : : "m" (n_pending)
: "cc", "memory" : not_stopped);
diff --git a/storage/innobase/sync/srw_lock.cc b/storage/innobase/sync/srw_lock.cc
index 2e22a01eb8f..82f8d615477 100644
--- a/storage/innobase/sync/srw_lock.cc
+++ b/storage/innobase/sync/srw_lock.cc
@@ -308,7 +308,10 @@ Hence, we will manually translate fetch_or() using GCC-style inline
assembler code or a Microsoft intrinsic function.
*/
-#if defined __GNUC__ && (defined __i386__ || defined __x86_64__)
+
+#if defined __clang_major__ && __clang_major__ < 10
+/* Only clang-10 introduced support for asm goto */
+#elif defined __GNUC__ && (defined __i386__ || defined __x86_64__)
# define IF_FETCH_OR_GOTO(mem, bit, label) \
__asm__ goto("lock btsl $" #bit ", %0\n\t" \
"jc %l1" : : "m" (mem) : "cc", "memory" : label);