From nobody Tue Jan 20 16:21:15 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 4dwXdP0gV9z6PmFN for ; Tue, 20 Jan 2026 16:21:29 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dwXdN5r8yz3M3y for ; Tue, 20 Jan 2026 16:21:28 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-47edd9024b1so35728325e9.3 for ; Tue, 20 Jan 2026 08:21:28 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768926087; x=1769530887; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=LAjc+9kEWG9zkdDiJQph8LlnLhQGdfB4tpYOCS5I11A=; b=amqPSwXiMjaiK2Zq/pAevPH7U9NbF4/2WZ5OF7pWb6bQyjs32WgvczltBc/EgQqPee dlJNJ5JWKqVaXzK3dUIWKzRREkNmVdnbUO45YtCnTaWVNJnPBz79P40XgY5hpN0Yh2Gb KxzAyL82vvoXLsVN3wypTAZL8R8KdFs+ukhCpCA6uYK0ut0nbTqKhCbHnwRzgbQdYzM8 cIdqaZgCwXPWjuv6jnHdOGf906Y3nVT9Z2Eq93OOaSvaauReXz8YS1AkisMiUrMom3di LTi4OnoduzvuyCYE+siU3889IkGK2R6HsHc2lzdlyHySXySQY6zJKBGaf6s8KSy2u2xc rZYA== X-Forwarded-Encrypted: i=1; AJvYcCUgeZAqY4/ZEL6YCCKMKmNgGUv019TZFSfVyeO5QbN+NBFL91XH/dEPf8ullqz4Ayrm5dYV5Vx3GctWzKN7iAvkBfnr@freebsd.org X-Gm-Message-State: AOJu0YwUPZdlEtJ8VY14LqfCS5magn8c64gdziQgr74QWq3qIhbo7nly V8gZ4LieI+I1+xqX0GR00XPDNq/RLOLxTtjCvrgRSdkCWFpYaOMMtOCSScZ4dZ6Kbh8= X-Gm-Gg: AY/fxX45IyucGubKmcqR8770vHEgFPsPm6Bh58M5xRZD7QSIt7QH/sWEXSy1dX84pc4 Rf55cEpEQ0UqPgJEZhsNCvf3EUVAjfXRWhSzkMoYx+nmj+xcRaWHUm86uhTFwz+I5xCDtlLIhtr oRqycktANZhzHl8oUbKJkd3PTpIP0Bmert15AIsNXGPMzI4uBrp1EyRDRb5pRYk3OLNdAgHfnMn CEKGItbt+ngEuusF86Du49abUNmHz9wOFUBR0O8+WYk83u9fdGLBh032OHDQ9fzZTsvWMvzHPjz dcPeWy5eRA9RNjt3mYV6kEdl6pfI52BVuKFOEHYFZNOzj+wXXbZERNnsza7TCUCwfDnTxfYHgFM EJacxB+SCedShP5cstITNOb89XGhYkiEx51sqK9BOQHZcai2r9RW3p0hIxMub7XDwF1NwRERNzx sAI+cE4Y7a1JAHOkUv+q0PFEBOYiY40cBzXyG6UHoBYwNq35BhlZd6 X-Received: by 2002:a05:600c:608a:b0:477:2f7c:314f with SMTP id 5b1f17b1804b1-48025ccb812mr161618685e9.10.1768926087373; Tue, 20 Jan 2026 08:21:27 -0800 (PST) Received: from smtpclient.apple (nat-184-7.net.cam.ac.uk. [131.111.184.7]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4801e8c05c3sm248953255e9.11.2026.01.20.08.21.26 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Jan 2026 08:21:26 -0800 (PST) Content-Type: text/plain; charset=utf-8 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 (Mac OS X Mail 16.0 \(3864.300.41.1.7\)) Subject: Re: git: 96acaa960023 - main - compat32: provide a type and a macro for (u)int64_t handling on non-x86 arches From: Jessica Clarke In-Reply-To: Date: Tue, 20 Jan 2026 16:21:15 +0000 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <4D876814-AA9D-4007-A165-4E0B7881B5C2@freebsd.org> References: <696f9463.f398.7ea9495a@gitrepo.freebsd.org> <7F0190E5-8B20-40A5-9D31-1D56BCF39E71@freebsd.org> To: Konstantin Belousov X-Mailer: Apple Mail (2.3864.300.41.1.7) X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Queue-Id: 4dwXdN5r8yz3M3y On 20 Jan 2026, at 16:07, Konstantin Belousov = wrote: >=20 > On Tue, Jan 20, 2026 at 04:05:19PM +0000, Jessica Clarke wrote: >> On 20 Jan 2026, at 14:42, Konstantin Belousov = wrote: >>>=20 >>> The branch main has been updated by kib: >>>=20 >>> URL: = https://cgit.FreeBSD.org/src/commit/?id=3D96acaa960023c20e852e04e7cc5c6a5f= aca36c67 >>>=20 >>> commit 96acaa960023c20e852e04e7cc5c6a5faca36c67 >>> Author: Konstantin Belousov >>> AuthorDate: 2026-01-12 04:45:36 +0000 >>> Commit: Konstantin Belousov >>> CommitDate: 2026-01-20 14:42:35 +0000 >>>=20 >>> compat32: provide a type and a macro for (u)int64_t handling on = non-x86 arches >>>=20 >>> uint64_t is 4-byte aligned on i386, but is 8-bytes aligned on all = other >>> 32bit arches FreeBSD supports. Provide the freebsd32_uint64_t = type and >>> the FU64_CP() macro, which are intended to be used where 32bit ABI = uses >>> (u)int64_t type, and do proper layout and copying for the = aggregate type. >>>=20 >>> Reviewed by: des, emaste >>> Sponsored by: The FreeBSD Foundation >>> MFC after: 1 week >>> Differential revision: https://reviews.freebsd.org/D54663 >>> --- >>> sys/compat/freebsd32/freebsd32.h | 11 ++++++++++- >>> sys/sys/abi_compat.h | 8 ++++++++ >>> 2 files changed, 18 insertions(+), 1 deletion(-) >>>=20 >>> diff --git a/sys/compat/freebsd32/freebsd32.h = b/sys/compat/freebsd32/freebsd32.h >>> index 9d724c93fee7..7324f9adf70c 100644 >>> --- a/sys/compat/freebsd32/freebsd32.h >>> +++ b/sys/compat/freebsd32/freebsd32.h >>> @@ -36,8 +36,17 @@ >>> #include >>>=20 >>> /* >>> - * i386 is the only arch with a 32-bit time_t >>> + * i386 is the only arch with a 32-bit time_t. >>> + * Also it is the only arch with (u)int64_t having 4-bytes = alignment. >>> */ >>> +typedef struct { >>> +#ifdef __amd64__ >>> + uint32_t val[2]; >>> +#else >>> + uint64_t val; >>> +#endif >>> +} freebsd32_uint64_t; >>=20 >> Any reason not to use: >>=20 >> typedef uint64_t freebsd32_uint64_t __aligned(4); >>=20 >> on amd64 (and normal typedef elsewhere)? Then you can just use the >> normal CP. See for example https://godbolt.org/z/svseWv7xo. > Yes, this way it uses only std C instead of the GNU extension, and not > depend on compiler properly handle unaligned types. >=20 > IMO it is better that way, and all machinery is hidden under the = typedef+ > the macro. Well, except (a) the kernel uses GNU C for all manner of things already (b) unaligned types are already well-supported otherwise packed structs wouldn=E2=80=99t work, which we=E2=80=99re happy to use (c) your = structure approach hides less as you have to use the magic FU64_CP macro so is less abstracted than my proposal. Also, I just thought to check Linux, and it uses the same GNU C aligned trick, so we=E2=80=99re in good company and any issues with it would = show up there, especially given people do use Clang to build Linux in production these days. So I disagree with your assessment entirely. Jessica