Discussion:
Natural alignment used on NetBSD/m68k
(too old to reply)
John Paul Adrian Glaubitz
2025-02-08 11:02:50 UTC
Permalink
Hello,

can anyone tell me whether NetBSD/m68k uses a natural alignment of two or four bytes?
I'm asking since Linux/m68k defaults to two bytes alignment which has started to become
a burden as more and more programs require at least four bytes alignment these days.
Software that is affected includes CPython, LLVM, Mold, gccgo and many more.

As Debian's m68k maintainer, I have been trying to convince the community to switch to
four bytes alignment, but so far an agreement has not been made. On the other hand, the
original SysV Unix ABI released by Motorola [1] defaults to four bytes alignment.

And maybe someone could compile and run the following code on a NetBSD/m68k instance to
confirm the alignment to be four bytes:

#include <stdio.h>

typedef struct { char x; int y; } test_t;

int main(void)
{
printf("%d\n", sizeof(test_t) / 2);
}

Thanks,
Adrian
[1] https://books.google.de/books/about/System_V_Application_Binary_Interface.html?id=7bImAAAAMAAJ&redir_esc=y
--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer
`. `' Physicist
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
John Klos
2025-02-08 11:37:54 UTC
Permalink
Hi,
Post by John Paul Adrian Glaubitz
can anyone tell me whether NetBSD/m68k uses a natural alignment of two
or four bytes? I'm asking since Linux/m68k defaults to two bytes
alignment which has started to become a burden as more and more programs
require at least four bytes alignment these days. Software that is
affected includes CPython, LLVM, Mold, gccgo and many more.
NetBSD uses four bytes.
Post by John Paul Adrian Glaubitz
As Debian's m68k maintainer, I have been trying to convince the
community to switch to four bytes alignment, but so far an agreement has
not been made. On the other hand, the original SysV Unix ABI released by
Motorola [1] defaults to four bytes alignment.
I've read some of the discussions about that. Your efforts are valiant and
appreciated. While I understand the resistance to change, what I don't
understand is how some people can think it can or should just simply never
change.

Of course it'd be great to switch, and I've wondered if there could be
some simple way to identify old versus new binaries so you wouldn't need a
compatibility flag day.
Post by John Paul Adrian Glaubitz
And maybe someone could compile and run the following code on a
#include <stdio.h>
typedef struct { char x; int y; } test_t;
int main(void)
{
printf("%d\n", sizeof(test_t) / 2);
}
4 :)

John

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Loading...