Page MenuHomeFreeBSD

D14018.id38380.diff
No OneTemporary

D14018.id38380.diff

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;

File Metadata

Mime Type
text/plain
Expires
Fri, Apr 24, 3:24 AM (3 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
32057737
Default Alt Text
D14018.id38380.diff (833 B)

Event Timeline