What changed, and why it matters
This is a minor build-compatibility fix for XMRig when compiled with the Clang compiler on 64-bit ARM (ARM64) processors. It changes a preprocessor condition so that Clang on ARM64 does not try to use a compiler feature (__builtin_prefetch) that may not be available, which could otherwise cause the build to fail. There is no indication this change fixes a security vulnerability or affects runtime behavior on already-working builds.
No security action required. Treat as a normal build-fix patch.
Security signals we found
No security-relevant signals detected in the diff or commit metadata.
Change is confined to a preprocessor guard controlling prefetch macros.
No pointer arithmetic, allocation, input parsing, authentication, or cryptographic changes.
Evidence from the diff
The patch narrows the GCC-style __builtin_prefetch branch to exclude Clang unless Clang explicitly advertises __builtin_prefetch via __has_builtin. Previously, #ifdef __GNUC__ was true for Clang, so Clang ARM64 builds could enter a path where __builtin_prefetch macros were defined even if the builtin was unsupported, potentially breaking compilation. The fallback path for non-GCC/non-prefetch Clang simply does nothing. This is a build-fix, not a memory-safety or correctness change.
Changed components
src/crypto/randomx/intrin_portable.hInspect captured patch +1 / −1
### src/crypto/randomx/intrin_portable.h
@@ -577,7 +577,7 @@ inline void* rx_aligned_alloc(size_t size, size_t align) {
# define rx_aligned_free(a) free(a)
#endif
-#ifdef __GNUC__
+#if defined(__GNUC__) && (!defined(__clang__) || __has_builtin(__builtin_prefetch))
#define rx_prefetch_nta(x) __builtin_prefetch((x), 0, 0)
#define rx_prefetch_t0(x) __builtin_prefetch((x), 0, 3)
#elseWhy this scored 18/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.