diff --git a/include/jemalloc/internal/spin_delay_arm.h b/include/jemalloc/internal/spin_delay_arm.h index 3ea86c6c..8d5628ed 100644 --- a/include/jemalloc/internal/spin_delay_arm.h +++ b/include/jemalloc/internal/spin_delay_arm.h @@ -11,6 +11,7 @@ void detect_arm_sb_support(void); /* Use SB instruction if available, otherwise ISB */ static inline void spin_delay_arm(void) { +#ifdef HWCAP_SB if (__builtin_expect(arm_has_sb_instruction == 1, 1)) { /* SB instruction encoding */ asm volatile(".inst 0xd50330ff \n"); @@ -18,4 +19,5 @@ spin_delay_arm(void) { /* ISB instruction */ asm volatile("isb; \n"); } +#endif // HWCAP_SB } diff --git a/src/spin_delay_arm.c b/src/spin_delay_arm.c index 975023b0..2aeb37d1 100644 --- a/src/spin_delay_arm.c +++ b/src/spin_delay_arm.c @@ -4,11 +4,6 @@ #if defined(__linux__) && (defined(__aarch64__) || defined(__arm64__)) #include - -/* Define HWCAP_SB if not already defined in system headers */ -#ifndef HWCAP_SB -#define HWCAP_SB (1ULL << 56) /* Speculation Barrier */ -#endif // HWCAP_SB #endif // __linux__ && (defined(__aarch64__) || defined(__arm64__)) /* Global variable to track SB support, defined here to avoid multiple definitions */