On Mon, 2025-06-16 at 10:45 +0200, Geert Uytterhoeven wrote: > The Linux kernel also knows m68k has an alignment of 2 bytes.
Yes, we have identified (some of) these parts yet. I suggested to add a kernel option for m68k to allow 4 bytes alignment there. > > > And yet it works without any problems so far. Please try the Gentoo > > > chroot yourself. > > > > Because most of the structures are correctly aligned by default, but > > some of them not. You must run glibc test suite and LTP to be sure there > > is no regression. > > Indeed. > > > In QEMU, alignment is defined here: > > > > include/user/abitypes.h > > > > for m68k the values to change are: > > > > #ifdef TARGET_M68K > > #define ABI_INT_ALIGNMENT 2 > > #define ABI_LONG_ALIGNMENT 2 > > #define ABI_LLONG_ALIGNMENT 2 > > #endif > > Note that it also used to have: > > #ifdef TARGET_CRIS > #define ABI_SHORT_ALIGNMENT 1 > #define ABI_INT_ALIGNMENT 1 > #define ABI_LONG_ALIGNMENT 1 > #define ABI_LLONG_ALIGNMENT 1 > #endif > > and still has: > > #if (defined(TARGET_I386) && !defined(TARGET_X86_64)) \ > || defined(TARGET_SH4) \ > || defined(TARGET_OPENRISC) \ > || defined(TARGET_MICROBLAZE) \ > || defined(TARGET_NIOS2) > #define ABI_LLONG_ALIGNMENT 4 > #endif > > which will probably become the next victim of the 64-bit little-endian > natural-alignment monoculture... Geert, I think this sentiment is not fair. As I we have previously discussed, the 2 bytes alignment on Linux/m68k was never intended by the SysV ELF ABI designers and it's based on a historical mistake. I don't understand why it's considered to be such an unorthodox change to make when even Commodore's own Amiga Unix uses 4 bytes alignment on the Amiga. You know that I am the last person on the planet to lobby for deprecating old and exotic architectures and ABIs. The motivation for this ABI change is the result of a decade-long frustration with alignment issues on Debian/m68k which I simply want to solve once and for all. > > And there will be a problem with binfmt_misc because we can't rely on > > the ELF signature to know which qemu-user to run, the one with 2byte > > alignment or the one with 4byte alignment? > > Exactly. We could use PT_NOTE [1] for this purpose. Adrian > [1] https://github.com/search?q=repo%3Aqemu%2Fqemu%20PT_NOTE&type=code -- .''`. John Paul Adrian Glaubitz : :' : Debian Developer `. `' Physicist `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913

