Re: Preliminary results - was: Re: Question on BIGGEST_ALIGNMENT in GCC on NetBSD/m68k
Geert Uytterhoeven <[email protected]> Thu, 2 Jul 2026 14:43:03 +0200
| Newsgroups | gmane.os.netbsd.ports.m68k,gmane.linux.debian.ports.68k,gmane.linux.ports.m68k |
|---|---|
| Message-ID | <CAMuHMdWdHVMdcAPgsgoRshY4nrQnnMHp9BCpo7SHnik37oySrg@mail.gmail.com> |
Hi Arnd, On Mon, 2 Feb 2026 at 11:53, Geert Uytterhoeven <[email protected]> wrot= e: > On Wed, 7 Jan 2026 at 09:20, Arnd Bergmann <[email protected]> wrote: > > On Tue, Jan 6, 2026, at 20:31, Geert Uytterhoeven wrote: > > > On Tue, 6 Jan 2026 at 16:38, Arnd Bergmann <[email protected]> wrote: > > >> On Tue, Jan 6, 2026, at 14:40, John Paul Adrian Glaubitz wrote: > > >> > On Tue, 2026-01-06 at 14:34 +0100, Kolbj=C3=B8rn Barmen wrote: > > >> The diffstat is > > >> > > >> 407 files changed, 2433 insertions(+), 754 deletions(-) > > >> > > >> and I think this touches around 1500 structures, though > > >> most files only have a single one. > > > > > > Thanks, this seems to work fine for atari_defconfig, and generates > > > the exact same code as before. I kept on updating this during the last few months (I guess/hope you did the same?) > > > > Ok, good. The more interesting bit then is what happens when > > you actually turn on -malign-int for the kernel itself. There > > It fails to build due to wrong and missing annotations in union __sifield= s: > > arch/m68k/kernel/signal.c:621:9: note: in expansion of macro =E2=80=98BUI= LD_BUG_ON=E2=80=99 > 621 | BUILD_BUG_ON(offsetof(siginfo_t, si_lower) !=3D 0x12); > > which is probably the same issue Kolla was seeing. The following are failing with -malign-int: BUILD_BUG_ON(offsetof(siginfo_t, si_lower) !=3D 0x12); BUILD_BUG_ON(offsetof(siginfo_t, si_upper) !=3D 0x16); BUILD_BUG_ON(offsetof(siginfo_t, si_pkey) !=3D 0x12); All of these are due to #define __ADDR_BND_PKEY_PAD (__alignof__(void *) < sizeof(short) ? \ sizeof(short) : __alignof__(void *)) (which is no longer correct for m68k and -malign-int), and incorrect/missin= g annotations for the three fields succeeding the use of the former. I couldn't fix it using the __uapi_* infrastructure you provided, but the following (gmail-whitespace-damaged) patch fixes the BUILD_BUG_ON()s: --- a/include/uapi/asm-generic/siginfo.h +++ b/include/uapi/asm-generic/siginfo.h @@ -71,8 +71,12 @@ union __sifields { struct { void __user *_addr; /* faulting insn/memory ref. */ +#ifdef __m68k__ +#define __ADDR_BND_PKEY_PAD sizeof(short) +#else #define __ADDR_BND_PKEY_PAD (__alignof__(void *) < sizeof(short) ? \ sizeof(short) : __alignof__(void *)) +#endif union { /* used on alpha and sparc */ int _trapno; /* TRAP # which caused the signal *= / @@ -84,13 +88,13 @@ union __sifields { /* used when si_code=3DSEGV_BNDERR */ struct { char _dummy_bnd[__ADDR_BND_PKEY_PAD]; - void __user *_lower; - void __user *_upper; + void __user *_lower __attribute__ ((packed, aligned(2))); + void __user *_upper __attribute__ ((packed, aligned(2))); } _addr_bnd; /* used when si_code=3DSEGV_PKUERR */ struct { char _dummy_pkey[__ADDR_BND_PKEY_PAD]; - __u32 _pkey; + __u32 _pkey __attribute__ ((packed, aligned(2))); } _addr_pkey; /* used when si_code=3DTRAP_PERF */ struct { Unfortunately the resulting kernel hangs (on ARAnyM) after: Console: colour dummy device 80x25 printk: legacy console [tty0] enabled Back to real work... Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k= .org In personal conversations with technical people, I call myself a hacker. Bu= t when I'm talking to journalists I just say "programmer" or something like t= hat. -- Linus Torvalds