From nobody Tue Jan 20 16:21:15 2026 X-Original-To: dev-commits-src-main@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 4dwXdP0f0Gz6PmCj for ; Tue, 20 Jan 2026 16:21:29 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (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 4dwXdN5qv8z3M61 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-f52.google.com with SMTP id 5b1f17b1804b1-4801bc32725so27401225e9.0 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=G4uyDIDqNG3TwZn793E/s87olQBE/uCGHS6tpPH/gW9bhdOGwI/Fjw4TpecCZaTuCl eBKpBiS4ibNtI9pL1Z8ioEwMgjVgMTTAE5dpCOsBI3Fs5lizsgnS9XZunRy9Hl/sTzwV GswOSojBXxLgWKA/ryaiMu91R7GZF4wTC4k6Xae40Kdh0/RG1DCg+5W3PiGcPwtoCZMB UBcwan40c2XtoWt02mBSjbCKF06xUDBzyLyQuSNET1/EP9/xEZ72e2ardD6KyOk8Np2h MEhm/Gvk8tS746YesJL59iF7ZLzSykWqYQXz/ZZYfYXKNwlaRmc3bz+/iHIRmoAsHQmR GCdw== X-Forwarded-Encrypted: i=1; AJvYcCWGYI3NXHLBOwdZiZ1tr56+LA8fa/45G2hAl081yHkAn09y+gkdB9tKJrzdrNCozEPXQwd/R8QDj2WUsGYIOp4v9wSxaA==@freebsd.org X-Gm-Message-State: AOJu0YzT4fO/+uw7kvlQmDu6m7mv/Z8PT1AAZR0pNPEIq7hl2gP/KSBv FE9IurmFRT7PJn8AF1jqRPhf3nRnV2TtO97EGSPcO9f8VFqxIqdBjnEVk7CZdjh2hMc8quBXgLm RxcM8 X-Gm-Gg: AY/fxX7IB2xdp+SDrnZ2pQMRJZFuGSFOUQo1z2Rn49FLfO1eJVaOOmVEI/wO7iFZ21K SYy32SpaIeaqmprG8Ifp0WvV/N5EGbneeMU2863WWCw+LoKJBWmO9J4fwL4hJZbdgqtPWHsisqo TeWcD+znwIFdWODOxRYLm69IHzgTqF+7eDDAO7J34GEsby6xD8uDiV8s9ZTfYBJpReqx6XhOw90 8eZ+hLdP0YTUqZjTJqdJMDG7PxOmyA06NhMhw2sJdWo0PV4drvvvfqUFwV7WjX+VW7M6y0JPrGE gdwjiMZADXJkK4aYhF61Xb1q6tbTSS3rZ7Riu6zLx1pqleIgxfdoe4VnBE2iFEnrnnXfly8gnnB AENGXA+30xQ8QrbZfbckS/KZCdzEMyRmJkMBQ4x9M8AWbpw06yWhQ9SzggpsR22ooqWr1qd0LMs HaBVzJJ3IT72hCCQYlKg1F2AyEcXHkvDw8+wdHJFVSBoxpaE1CH0Ew 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 the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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: 4dwXdN5qv8z3M61 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