Index: sys/mips/mips/machdep.c =================================================================== --- sys/mips/mips/machdep.c +++ sys/mips/mips/machdep.c @@ -383,7 +383,16 @@ void mips_postboot_fixup(void) { - static char fake_preload[256]; + /* + * Ensure the buffer is properly aligned to hold module metadata structures. + * When building the kernel with gcc+bfd fake_preload was always + * sufficiently aligned. However, when building with clang the compiler is + * less conservative and will only align it to 4 bytes which is not enough + * on a MIPS64 system which will use `sd` to store to this buffer. + * + * TODO: Once we depend on C11 we can use _Alignas(u_long) instead. + */ + static char fake_preload[256] __aligned(_Alignof(u_long)); caddr_t preload_ptr = (caddr_t)&fake_preload[0]; size_t size = 0;