]> git.ipfire.org Git - thirdparty/knot-dns.git/commitdiff
kru: fix collision if target architecture/optimization is specified
authorDaniel Salzman <daniel.salzman@nic.cz>
Sat, 18 Oct 2025 17:10:10 +0000 (19:10 +0200)
committerDaniel Salzman <daniel.salzman@nic.cz>
Mon, 27 Oct 2025 08:28:48 +0000 (09:28 +0100)
Related to https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=289611

src/knot/modules/rrl/kru-avx2.c

index 4e7a9391916c966d6990ece35afb214f2d2be5f5..8f484e4213bf8efd1b70fcc34393abc70b28537a 100644 (file)
 
 // This file has code for new-ish x86 (2015+ usually, Atom 2021+) - AES + AVX2
 #ifdef __clang__
-       #pragma clang attribute push (__attribute__((target("arch=x86-64-v3,aes"))), \
-                                                       apply_to = function)
+       // Force using specific instructions only if target architecture/optimization not specified
+       #if !defined(__AVX2__)
+               #pragma clang attribute push (__attribute__((target("arch=x86-64-v3,aes"))), \
+                                                               apply_to = function)
+       #endif
 #else
        #pragma GCC push_options
        #if __GNUC__ >= 11
@@ -41,7 +44,9 @@
 const struct kru_api KRU_AVX2 = KRU_API_INITIALIZER;
 
 #ifdef __clang__
-       #pragma clang attribute pop
+       #if !defined(__AVX2__)
+               #pragma clang attribute pop
+       #endif
 #else
        #pragma GCC pop_options
 #endif