[Bug 289611] dns/knot3: Fix build error by CPU optimizing

From: <bugzilla-noreply_at_freebsd.org>
Date: Sun, 14 Sep 2025 22:13:10 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=289611

            Bug ID: 289611
           Summary: dns/knot3: Fix build error by CPU optimizing
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: ports-bugs@FreeBSD.org
          Reporter: nork@FreeBSD.org
                CC: freebsd@dns.company
             Flags: maintainer-feedback?(freebsd@dns.company)
                CC: freebsd@dns.company

Created attachment 263802
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=263802&action=edit
files/patch-src_knot_modules_rrl_kru-avx2.c

There is an issue with the Knot3 build that is not optimized properly on
SandyBridge and later CPUs.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
In file included from knot/modules/rrl/kru-avx2.c:43:
knot/modules/rrl/./kru.inc.c:250:7: error: always_inline function
'_mm_load_si128' requires target feature 'pclmul', but would be inlined into
function 'kru_limited_prefetch' that is compiled without support for 'pclmul'
  250 |                 h = _mm_load_si128((__m128i *)key);
      |                     ^
  :
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
*** [knot/modules/rrl/libknotd_la-kru-avx2.lo] Error code 1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -

If you are targeting IceLake and/or later CPUs, there is a problem with the
following code:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
#pragma clang attribute push (__attribute__((target("arch=x86-64-v3,aes"))),
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
The pragma is missing, so you need to add it as follows:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
#pragma clang attribute push
(__attribute__((target("arch=x86-64-v4,aes,pclmul,adx,rdseed,rdrnd,prfchw,xsaveopt,xsaves,avx512vnni,pku,clwb,fsgsbase,clflushopt,invpcid,xsavec"))),
apply_to = function)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
OR simplefully,
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
#pragma clang attribute push (__attribute__((target("arch=icelake-client"))),
apply_to = function)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -

I think that it just seems like unnecessary code, at least on FreeBSD.

-- 
You are receiving this mail because:
You are the assignee for the bug.