Re: git: 97ce8f7d2b8e - main - amd64: define and use STACKALIGN and REDZONE_SZ

From: Konstantin Belousov <kostikbel_at_gmail.com>
Date: Tue, 17 Feb 2026 20:01:46 UTC
On Tue, Feb 17, 2026 at 02:42:20PM -0500, John Baldwin wrote:
> On 2/16/26 21:44, Konstantin Belousov wrote:
> > On Mon, Feb 16, 2026 at 05:01:58PM -0800, Enji Cooper (yaneurabeya) wrote:
> > > 
> > > > On Feb 9, 2026, at 9:57 AM, Konstantin Belousov <kib@FreeBSD.org> wrote:
> > > > 
> > > > The branch main has been updated by kib:
> > > > 
> > > > URL: https://cgit.FreeBSD.org/src/commit/?id=97ce8f7d2b8eff42460f60e8c49d9849b58b6e81
> > > > 
> > > > commit 97ce8f7d2b8eff42460f60e8c49d9849b58b6e81
> > > > Author:     Konstantin Belousov <kib@FreeBSD.org>
> > > > AuthorDate: 2026-02-07 00:36:44 +0000
> > > > Commit:     Konstantin Belousov <kib@FreeBSD.org>
> > > > CommitDate: 2026-02-09 17:57:00 +0000
> > > > 
> > > >     amd64: define and use STACKALIGN and REDZONE_SZ
> > > > 
> > > >     Reviewed by:    brooks, emaste, jhb
> > > >     Sponsored by:   The FreeBSD Foundation
> > > >     MFC after:      1 week
> > > >     Differential revision:  https://reviews.freebsd.org/D55151
> > > 
> > > Hi kib@!
> > > 	It looks like this broke the build with gcc12 on main: https://ci.freebsd.org/job/FreeBSD-main-amd64-gcc14_build/2893/console .
> > 
> > https://reviews.freebsd.org/D55319
> > might be the fix.
> 
> I have the same thing at https://reviews.freebsd.org/D55161
> 
> Per my comments there, I do think it might break 32-bit kernels, but we probably
> don't care about that.  (Namely, if rounddown2() is used on a type larger than
> uintptr_t such as trunc_page on a vm_paddr_t on i386, this change truncates the
> value).
> 
> If we really care, we could use _Generic or the like to only use the uintptr_t
> casts for pointer types.

I must admit that I initially wrote the cast to uintmax_t, and only then
looked at the nearby code (__builtin_align_up() and others).  Since
uintptr_t was good enough for them, I used it in the patch as well.