From nobody Sat Apr 18 01:12: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 4fyDJT23M4z6ZTcq for ; Sat, 18 Apr 2026 01:12:57 +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 4fyDJS66hJz3nXx for ; Sat, 18 Apr 2026 01:12:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1776474776; 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=YJo2A/ABmjTQpR5HJnej4fyl+PO7+4it+lh8j+bzuKw=; b=OcxmAeBLs6ziu8Ea2BH8fTkyigkVKlAFdIbTN9SqCK9DsSBbVLF4CbCy3K3IuYdnzTiYSv 89XycdRsm3C1mBivRhuhZxzdB+9N5wNidgtUl+25GtlPeX7eb7UQZfyjCZ9ukeuWkJSvIe JmL911GrGGzyoCktZ7cOHGkE1//mR8AIRWgNufCsV3IGj9qX/zbQ5UKUu/VefYlewPrf8y UjzZjhM9fwtKh8ONs1/ymZBck8ywS7nIkH0vPXuQa/ojY2nzgvkyuvY2xX046qR8vOJhZS M9iowUhpFtRk172k81Ol5WqjAOFOlyewslC+QsQtYbzV5l/x3oK/HnDid0qQag== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1776474776; a=rsa-sha256; cv=none; b=q7rE22BSRVcZZKuCk0vYyMlIIAXQnF+Fb4jVSQXbRVzDkWMumASnWPh5lul5P/+IDV6Yb7 8PGEROXOB1KmGov1i0G0uES9PrkMBJxRwTUJs0kES725LvKB7lNlQ41qqUFsk+Xs6MpbKi 2anXwdpEGETpO+bt1VR3WRU/50Jz/mkH/Jzqk35Wg4lM2SpHMeH1X8iXerB7FHOs18boWP l9wu2bMtHK5rshpxigSigBmE0nlptJ/IZXjOV4IhS0vIW/U5P6j1qYhABHZy6zK+E1pW5z e9UKxH7eJTDo/t8Qs6u/AWYN1Nnj8qjhRX1QC+ypkdSmALgcKInxtR7h6o8A/w== 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=1776474776; 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=YJo2A/ABmjTQpR5HJnej4fyl+PO7+4it+lh8j+bzuKw=; b=ezHQzRG8nGY4rY/EN1qct4CNxmvJtZCdWi0qTQTvBpMwvFTtNspr8b99GbuNtPsB3VtZtP 7xQJ06+a5QEIYqK1kAyvJz4perzhaUv2s4FL7c/mNnqxZdIS/C1YdxQiVVwzeGjkCkRNVM cNiKJFXR7bcOEhegAQ8dCUtNQ8b4Njsxv/rTnhLH0XOV1XyNeZxtQZ+fHWFEoEr+jxclJG uDCovZcAQdu7F5Y4HzzrJ2hwz4NaDfMiSgDA6qi1KY0J3QbUmojpnMqM1Kq7O6McI0OymV ONv5nAVucnQxCqvzh0bfolHThJ7DIfqIfRbEXyQCrvtnvM6yFjyoP7Hcf2tHFQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4fyDJS5Kpjz33D for ; Sat, 18 Apr 2026 01:12:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 466c6 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 18 Apr 2026 01:12:56 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bjoern A. Zeeb Subject: git: 524df650a92f - main - 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/main X-Git-Reftype: branch X-Git-Commit: 524df650a92f648e19ba27d6727bdc79c8efdbbb Auto-Submitted: auto-generated Date: Sat, 18 Apr 2026 01:12:56 +0000 Message-Id: <69e2da98.466c6.18a2eb93@gitrepo.freebsd.org> The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=524df650a92f648e19ba27d6727bdc79c8efdbbb commit 524df650a92f648e19ba27d6727bdc79c8efdbbb Author: Bjoern A. Zeeb AuthorDate: 2026-04-14 15:06:56 +0000 Commit: Bjoern A. Zeeb CommitDate: 2026-04-18 01:12:12 +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 MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D56393 --- 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