Re: Question on BIGGEST_ALIGNMENT in GCC on NetBSD/m68k
Geert Uytterhoeven <[email protected]> Mon, 16 Jun 2025 10:45:13 +0200
| Newsgroups | gmane.linux.ports.m68k,gmane.os.netbsd.ports.m68k,gmane.linux.debian.ports.68k |
|---|---|
| Message-ID | <CAMuHMdUA9e4iLBdna3YPo8ng80q3F1KT7GH298_wgULPTdyE9A@mail.gmail.com> |
On Mon, 16 Jun 2025 at 10:33, Laurent Vivier <[email protected]> wrote: > Le 16/06/2025 à 10:14, John Paul Adrian Glaubitz a écrit : > > On Mon, 2025-06-16 at 10:00 +0200, Laurent Vivier wrote: > >>> Could you point me to these packages which assume 2 bytes alignment? I'm genuinely > >>> interested as I would like to put these up on the wiki. So far I haven't found any. > >>> I have used Debian's rebootstrap to create an initial set of m68k packages with > >>> 4 bytes alignment and didn't run into any problems yet. > >>> > >>> The Gentoo developers have also successfully created a chroot with 4 bytes alignment: > >>> > >>> https://dev.gentoo.org/~dilfridge/m68k/ > >>> > >>> I have tried it and it worked fine for me with qemu-user. > >>> > >>> So, if there is any software that is incompatible with 4 bytes alignment on m68k, I > >>> would like to hear about it. > >> > >> qemu-user is one of these softwares that know m68k has alignment of > >> 2byte. All the structures translated from the m68k chroot to the host > >> kernel are with a 2byte alignment. The Linux kernel also knows m68k has an alignment of 2 bytes. > > 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... > 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. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] 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