]> 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, 20 Oct 2025 08:32:54 +0000 (10:32 +0200)
Related to https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=289611

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

index e414cb9e64d599f52ee20941bdfff027a9122f6a..2856198616e8189c86eb85cb93d39184986a9b0e 100644 (file)
@@ -9,8 +9,11 @@
 
 // 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
@@ -30,7 +33,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