mirror of
https://github.com/MariaDB/server.git
synced 2025-01-15 19:42:28 +01:00
MDEV-34815 SIGILL error when executing mariadbd compiled for RISC-V with Clang
RISC-V and Clang produce rdcycle for __builtin_readcyclecounter. Since Linux kernel 6.6 this is a privileged instruction not available to userspace programs. The use of __builtin_readcyclecounter is excluded from RISCV falling back to the rdtime/rdtimeh instructions provided in MDEV-33435. Thanks Alexander Richardson for noting it should be linux only in the code and noting FreeBSD RISC-V permits rdcycle. Author: BINSZ on JIRA
This commit is contained in:
parent
3d23adb766
commit
aca72b326a
1 changed files with 2 additions and 2 deletions
|
@ -97,7 +97,7 @@ C_MODE_START
|
||||||
/**
|
/**
|
||||||
A cycle timer.
|
A cycle timer.
|
||||||
|
|
||||||
On clang we use __builtin_readcyclecounter(), except for AARCH64.
|
On clang we use __builtin_readcyclecounter(), except for AARCH64 and RISC-V.
|
||||||
On other compilers:
|
On other compilers:
|
||||||
|
|
||||||
On IA-32 and AMD64, we use the RDTSC instruction.
|
On IA-32 and AMD64, we use the RDTSC instruction.
|
||||||
|
@ -152,7 +152,7 @@ C_MODE_START
|
||||||
*/
|
*/
|
||||||
static inline ulonglong my_timer_cycles(void)
|
static inline ulonglong my_timer_cycles(void)
|
||||||
{
|
{
|
||||||
# if __has_builtin(__builtin_readcyclecounter) && !defined (__aarch64__)
|
# if __has_builtin(__builtin_readcyclecounter) && !defined (__aarch64__) && !(defined(__linux__) && defined(__riscv))
|
||||||
#define MY_TIMER_ROUTINE_CYCLES MY_TIMER_ROUTINE_AARCH64
|
#define MY_TIMER_ROUTINE_CYCLES MY_TIMER_ROUTINE_AARCH64
|
||||||
return __builtin_readcyclecounter();
|
return __builtin_readcyclecounter();
|
||||||
# elif defined _M_IX86 || defined _M_X64 || defined __i386__ || defined __x86_64__
|
# elif defined _M_IX86 || defined _M_X64 || defined __i386__ || defined __x86_64__
|
||||||
|
|
Loading…
Reference in a new issue