Skip to content

Commit cb4a90e

Browse files
committed
Fix building with Clang on RISC-V
Clang does not have the builtin __builtin_riscv_pause(). Forwarded: MariaDB#3871
1 parent bce8c6a commit cb4a90e

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
From: Jeremie Courreges-Anglas <[email protected]>
2+
Date: Wed, 5 Mar 2025 16:10:38 -0500
3+
Subject: Fix building with Clang on RISC-V
4+
5+
Clang does not have the builtin __builtin_riscv_pause().
6+
7+
Forwarded: https://github.com/MariaDB/server/pull/3871
8+
---
9+
include/my_cpu.h | 4 ++++
10+
1 file changed, 4 insertions(+)
11+
12+
--- a/include/my_cpu.h
13+
+++ b/include/my_cpu.h
14+
@@ -97,7 +97,11 @@
15+
/* Changed from __ppc_get_timebase for musl and clang compatibility */
16+
__builtin_ppc_get_timebase();
17+
#elif defined __GNUC__ && defined __riscv
18+
+#ifdef __clang__
19+
+ __asm__ volatile(".long 0x0100000f" ::: "memory");
20+
+#else
21+
__builtin_riscv_pause();
22+
+#endif
23+
#elif defined __GNUC__
24+
/* Mainly, prevent the compiler from optimizing away delay loops */
25+
__asm__ __volatile__ ("":::"memory");

debian/patches/series

+1
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ fix-reproducible-builds-rocksdb.patch
77
mroonga-mrn-lib-dirs-path-reproducible-build.patch
88
2006-kfreebsd-amd64.patch
99
1063738-revert-c432c9ef.patch
10+
MDEV-36217-Fix-building-with-older-Clang-on-RISC-V.patch

0 commit comments

Comments
 (0)