From nobody Wed Apr 22 21:08:56 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4g1Bfc6ky8z6bLDq for ; Wed, 22 Apr 2026 21:08:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4g1Bfc3fMNz3ljG for ; Wed, 22 Apr 2026 21:08:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1776892136; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=mntprDghwJv4SAqWCBoB4LQAYODjqz83prjbOgKUQQ4=; b=rsUXFfmDzuG/8IhsCctzjN7NvcVSUhNnxsFQXFHhxcZPZzHEmzoXGNkUXELuhno1/fhdcU InE7fOciXRky7gjglYtyNDIIKsYzqUe+e3+6fpD3L9Y0RmKXRs1rvdH+jXUCr7MGqXAK+y EwQ0G1zqAax1gJJiRJxCmHkNvldidyUCOJBbwimhQgkhUGrJr7uaFMAJBUjmBgwRSwmXoQ xMEWLX7Cq3T7TrukeJSmqsRxAFrSw0OksQX3u5Awd3Os9IpEj60txdrkOPiz0Q4EZNJ12m eH/HYsl9IJQ/ctT9jj9u4ncTqhsM7X+4WNdOwRhDZuKY6FilxNM7vjI2474Xmg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1776892136; a=rsa-sha256; cv=none; b=q0JJ5qZuSeoMHGbtIIbcIo5xyQEBY6bWXLBK24OeFNc8/R4DegVHfbB100bXi18dXvGSf3 R5qlBJis1ofi3zpwITUMVXGvCl6UAhiA3H/9v1D2m94HHZBENXRHvFEbAfD9RunNylpJ3E b2zZdz9MpIqoELZ/ytSPoFkdYXeFOVz8MTSLCAc/vid4VI+41jJQgWF9dVv/B0nUheZdPh 1PI7b+nJhWQ+r/4vXQyaNNmqqga6qzxGvl0Hz8icxrcjKfEEaBkUuAYpDplZFBuhoTncTE RDjgiDYraTWP8fj7t7STFjHKJ6qjFrTSDq3/ApkxFjnFSKLw4fOU2TQLHAcN6w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1776892136; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=mntprDghwJv4SAqWCBoB4LQAYODjqz83prjbOgKUQQ4=; b=W2TR/hTnMT+vVG7UeWH6gWdyPYdWurKdwZz2yJBSl9M67ese+XOnhCnXGUaWgAdd8BXmGd Cs3+IyvE4lNjbaimZpfjU0I5ShKKoORm3z8+U1woR5FV+vaOOYPa1jHCnJmOQNuphY+ueh 9nCwHJvPLWoY0doILYKnwllPkKnxW/3ar0U/26ATrZRJ5ss5jAmlqOGg3soMZR20Ad+gM+ J/QhFEtiG1xe/cxG/OQK4hBOJfTdcURjsqMQuzm9lfTHGQ99pS7em44Ot3d71AUNlkKZHX dnYoxV5WpywhHUjRyolJws9m8K+5nfdyCmexvyvuH1+Ntp5ooiuy6fZF5/c2DQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4g1Bfc3C7pznZv for ; Wed, 22 Apr 2026 21:08:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 30b01 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 22 Apr 2026 21:08:56 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Bjoern A. Zeeb Subject: git: 70cc86a2c8c0 - stable/15 - LinuxKPI: conditionally add __flex_counter() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 70cc86a2c8c042e48162b891e53f1d4ad74e8bb6 Auto-Submitted: auto-generated Date: Wed, 22 Apr 2026 21:08:56 +0000 Message-Id: <69e938e8.30b01.5822fc32@gitrepo.freebsd.org> The branch stable/15 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=70cc86a2c8c042e48162b891e53f1d4ad74e8bb6 commit 70cc86a2c8c042e48162b891e53f1d4ad74e8bb6 Author: Bjoern A. Zeeb AuthorDate: 2026-04-14 15:06:56 +0000 Commit: Bjoern A. Zeeb CommitDate: 2026-04-22 20:57:08 +0000 LinuxKPI: conditionally add __flex_counter() __flex_counter() is used by overflow.h and needed for "flex allocations". It is either a void * typed 0 (NULL) (like this for _Generic checks), or uses __builtin_counted_by_ref. The latter was added to gcc and llvm fairly recently and while for gcc the __has_builtin() check suffices, clang had parts broken until recently so needs an extra check for the next major version. The fixed hash is currently not part of any tag to use, so we play it save (and hope 23 will have it). It will be a while until we will see the builting to be used but at least we will be prepared for it. See inline comments for the commit hashes and versions which added the feature. Sponsored by: The FreeBSD Foundation Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D56393 (cherry picked from commit 524df650a92f648e19ba27d6727bdc79c8efdbbb) --- sys/compat/linuxkpi/common/include/linux/compiler_types.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/compiler_types.h b/sys/compat/linuxkpi/common/include/linux/compiler_types.h index 7151c03de690..25e69f5afd8e 100644 --- a/sys/compat/linuxkpi/common/include/linux/compiler_types.h +++ b/sys/compat/linuxkpi/common/include/linux/compiler_types.h @@ -42,4 +42,17 @@ #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) +/* + * __builtin_counted_by_ref was introduced to + * - gcc in e7380688fa59 with a first release tag of gcc-15.1.0, + * - llvm in 7475156d49406 with a first release tag of llvmorg-20.1.0-rc1 + * but cannot be used before 23 (22.x.y possibly) (see 09a3d830a888). + */ +#if (__has_builtin(__builtin_counted_by_ref)) && \ + (!defined(__clang__) || (__clang_major__ >= 23)) +#define __flex_counter(_field) __builtin_counted_by_ref(_field) +#else +#define __flex_counter(_field) ((void *)NULL) +#endif + #endif