Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MDEV-36217: Fix building with Clang and GCC on RISC-V #3871

Merged
merged 1 commit into from
Mar 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion include/my_cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,12 @@ static inline void MY_RELAX_CPU(void)
/* Changed from __ppc_get_timebase for musl and clang compatibility */
__builtin_ppc_get_timebase();
#elif defined __GNUC__ && defined __riscv
__builtin_riscv_pause();
/* The GCC-only __builtin_riscv_pause() or the pause instruction is
encoded like a fence instruction with special parameters. On RISC-V
implementations that do not support arch=+zihintpause this
instruction could be interpreted as a more expensive memory fence;
it should not be an illegal instruction. */
__asm__ volatile(".long 0x0100000f" ::: "memory");
#elif defined __GNUC__
/* Mainly, prevent the compiler from optimizing away delay loops */
__asm__ __volatile__ ("":::"memory");
Expand Down