Port-m68k archive

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

Re: Question on BIGGEST_ALIGNMENT in GCC on NetBSD/m68k



Hi Adrian,

On 05/06/2025 08:39, John Paul Adrian Glaubitz wrote:
Hi Jean-Michel,

On Thu, 2025-06-05 at 08:24 +0200, Jean-Michel Hautbois wrote:
I tried to patch gcc-13 with this BIGGEST_ALIGNMENT set to 64. I am
using buildroot+uclibc-ng on a Coldfire (mcf54418).

Thanks a lot for testing! Such contributions are highly appreciated.

Everything build fine, except the kernel:

In function ‘siginfo_build_tests’,
      inlined from ‘restore_sigcontext’ at arch/m68k/kernel/signal.c:684:2,
      inlined from ‘do_sigreturn’ at arch/m68k/kernel/signal.c:775:9:
././include/linux/compiler_types.h:542:45: error: call to
‘__compiletime_assert_351’ declared with attribute error: BUILD_BUG_ON
failed: offsetof(siginfo_t, si_lower) != 0x12
    542 |         _compiletime_assert(condition, msg,
__compiletime_assert_, __COUNTER__)
        |                                             ^
././include/linux/compiler_types.h:523:25: note: in definition of macro
‘__compiletime_assert’
    523 |                         prefix ## suffix();
          \
        |                         ^~~~~~
././include/linux/compiler_types.h:542:9: note: in expansion of macro
‘_compiletime_assert’
    542 |         _compiletime_assert(condition, msg,
__compiletime_assert_, __COUNTER__)
        |         ^~~~~~~~~~~~~~~~~~~
./include/linux/build_bug.h:39:37: note: in expansion of macro
‘compiletime_assert’
     39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond),
msg)
        |                                     ^~~~~~~~~~~~~~~~~~
./include/linux/build_bug.h:50:9: note: in expansion of macro
‘BUILD_BUG_ON_MSG’
     50 |         BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: "
#condition)
        |         ^~~~~~~~~~~~~~~~
arch/m68k/kernel/signal.c:621:9: note: in expansion of macro ‘BUILD_BUG_ON’
    621 |         BUILD_BUG_ON(offsetof(siginfo_t, si_lower) != 0x12);
        |         ^~~~~~~~~~~~
make[5]: *** [scripts/Makefile.build:207: arch/m68k/kernel/signal.o] Error 1
make[4]: *** [scripts/Makefile.build:465: arch/m68k/kernel] Error 2
make[4]: *** Waiting for unfinished jobs....

This is a 6.14.
Any idea about this ?

It looks like this check needs to be patched:

	BUILD_BUG_ON(offsetof(siginfo_t, si_lower) != 0x12);

The source code in arch/m68k/kernel/signal.c contains a lot of hard-wired offsets
which will probably have to be adjusted.

You can try changing 0x12 to 0x14 and see if that fixes it.

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);
--
2.39.5

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...

Thanks,
JM


Home | Main Index | Thread Index | Old Index