[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Question on BIGGEST_ALIGNMENT in GCC on NetBSD/m68k



Hi Adrian,

On Thu, 5 Jun 2025 at 08:56, John Paul Adrian Glaubitz
<glaubitz@physik.fu-berlin.de> wrote:
> On Thu, 2025-06-05 at 08:50 +0200, Jean-Michel Hautbois wrote:
> > I had to change three offsets:
> > diff --git a/arch/m68k/kernel/signal.c b/arch/m68k/kernel/signal.c
> > index e628b859ef21..5b8ef98565c2 100644
> > --- a/arch/m68k/kernel/signal.c
> > +++ b/arch/m68k/kernel/signal.c
> > @@ -618,11 +618,11 @@ static inline void siginfo_build_tests(void)
> >          BUILD_BUG_ON(offsetof(siginfo_t, si_addr_lsb) != 0x10);
> >
> >          /* _sigfault._addr_bnd */
> > -       BUILD_BUG_ON(offsetof(siginfo_t, si_lower) != 0x12);
> > -       BUILD_BUG_ON(offsetof(siginfo_t, si_upper) != 0x16);
> > +       BUILD_BUG_ON(offsetof(siginfo_t, si_lower) != 0x14);
> > +       BUILD_BUG_ON(offsetof(siginfo_t, si_upper) != 0x18);
> >
> >          /* _sigfault._addr_pkey */
> > -       BUILD_BUG_ON(offsetof(siginfo_t, si_pkey) != 0x12);
> > +       BUILD_BUG_ON(offsetof(siginfo_t, si_pkey) != 0x14);
> >
> >          /* _sigfault._perf */
> >          BUILD_BUG_ON(offsetof(siginfo_t, si_perf_data) != 0x10);
>
> OK, great. This is valuable information.
>
> > The kernel is booting, so, I suppose it is working :-).
> > Now, I can't send a patch fixing the offsets like that, as it depends on
> > the BIGGEST_ALIGNMENT value...
>
> Yes, please send a patch. I don't expect it to be accepted immediately, but
> it will help us spur a discussion on the necessary changes in the kernel.

It will be NAKed, because it would break the ABI.

Thank you for providing solid evidence that changing the default
alignment in the compiler will break the ABI, and is thus unacceptable.
(I wanted to test-compile all uapi headers to find differences, but
ran into many headers not being self-contained, or causing conflicts).

Feel free to start arch/m68k32/ to work around this ;-)

BTW, looking into the history of __ADDR_BND_PKEY_PAD() (which is
overkill on m68k, as __alignof__(void *) = 2, but might still be useful
for anyone wanting to revive CRIS support ;-), I ran into Andreas'
explanation why the minimal alignment is still 2 bytes:
https://lore.kernel.org/all/87y3i442w1.fsf@linux-m68k.org/.
(TL;DR: SunOS started on 68000).

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. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds


Reply to: