Skip to content

Commit

Permalink
MDEV-26467 fixup for clang-9 and earlier
Browse files Browse the repository at this point in the history
Before clang-10, asm goto was not supported, so we must use fetch_or().
  • Loading branch information
dr-m committed Oct 12, 2021
1 parent d8b8258 commit ebd5205
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion storage/innobase/include/fil0fil.h
Expand Up @@ -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);
Expand Down
5 changes: 4 additions & 1 deletion storage/innobase/sync/srw_lock.cc
Expand Up @@ -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);
Expand Down

0 comments on commit ebd5205

Please sign in to comment.