Re: Question on BIGGEST_ALIGNMENT in GCC on NetBSD/m68k

John Paul Adrian Glaubitz <[email protected]> Wed, 18 Jun 2025 14:27:22 +0200
Newsgroups gmane.os.netbsd.ports.m68k,gmane.linux.debian.ports.68k,gmane.linux.ports.m68k
Message-ID <6e0e0cf97b77d881b67916889d4b172c5bbdda00.camel@physik.fu-berlin.de>
Hi Greg,

On Wed, 2025-06-18 at 22:21 +1000, Greg Ungerer wrote:
> > Could you please elaborate this a bit more, please?
> >=20
> > Coldfire is handled as a separate target via TARGET_COLDFIRE in GCC, so=
 we
> > would certainly be able to toggle the alignment settings independent of
> > what's done on classic m68k.
>=20
> The net out is that it is the same gcc compiler, m68k-linux-gcc.
> ColdFire just needs specific code generation via command line switches,
> like -m5200 (or -m5206e or -m5307 or -mcfv4e, etc). This is the same way
> you would specify 680x0 level - m68020, -m68030, etc.

Yes, but there is a TARGET_COLDFIRE macro as I mentioned above which could
be used to trigger which alignment to use by default. I don't see how that
would complicate things.

> The bulk of the instruction set is the same. Asm code will look totally
> familiar to anyone who knows m68k :-)   One notable difference is that
> there is a more limited set addressing modes for some instructions.

True, but you won't be able to run any classic m68k binaries on ColdFire
and the other way around, are you?

> FWIW ColdFire currently uses the same ABI as all other m68k, so it uses
> 2-byte alignment today.

I know. And one user on the LKML has already demonstrated that his Coldfire
board booted fine with buildroot set to 4 bytes alignment.

> > In the Linux kernel, Coldfire is also a separate
> > arch, so the alignment settings can also be handled there separately if=
 necessary.
>=20
> ColdFire is not handled as a separate architecture in linux, it is just a
> variant of m68k - so uses arch/m68k in the source.

Well, it's a separate sub-architecture, similar to what's done for sh3/sh4 =
on sh
or the various ARM flavors. My point was just that there is a way to separa=
te
classic m68k and Coldfire code if necessary.

> > It's not really necessary to enforce this on Coldfire. However, since b=
uildroot
> > builds completely from source, it wouldn't even be a problem to change =
the alignment
> > there as well.
>=20
> Yes, that is totally right in my experience. Certainly in my ColdFire wor=
k
> it is pretty much always a build-everything approach via buildroot or sim=
ilar.
> I wouldn't think an ABI change would actually worry too many ColdFire use=
s,
> they don't use distributions like debian on them. (I would love to hear f=
rom
> anyone who does!).

Thanks a lot for confirming this!

Adrian

--=20
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913