68k¶
The fork uses upstream's experimental M68k backend for AmigaOS, the Atari ST family and classic Mac OS, with code generation fixes found while building picolibc, libc++ and the SDK examples:
- correct 68000 code for compares, carries (
scsrather thansubx) and thesetcccarry; mulu.wandmuls.wfor 32-bit products of 16-bit values;- stores to addresses that an instruction cannot encode, and stack array addresses with an index register;
- inline assembly: the
"cc"clobber, and subregisters for narrow explicit-register operands; - no select between loads of different types in the DAG combiner.
lld links m68k ELF programs, and compiler-rt builds its builtins for the 68000.
AmigaOS¶
m68k-amigaos finds the builtins in the sysroot and links libamiga.a
when it is there. See the Amiga SDK.
Atari TOS¶
m68k-atari-tos follows gcc's m68k-atari-mint ABI. See the
Atari SDK.
Classic Mac OS¶
On 68k, pascal functions use the Pascal calling convention (arguments
pushed left to right, the callee pops them, the result on the stack),
and __attribute__((raw_inline(0xA9F0))) makes calls to a function
compile to those words, which is how Toolbox traps are declared. See the
Classic Mac OS SDK.