I would quite like to resurrect my openkick project. As I note on that project's README.md, it is stalled because GNU GCC is not fit for purpose.

Sadly, there do not seem to be any other modern compilers which still have (or ever had) m68k support. The LLVM backend appeared to be my best bet but the architecture-specific code-generator is woefully underdocumented and rather brittle and my attempts to add a m68k backend are not promising. There are already a handful of incomplete m68k backends on github (e.g. kwaters/llvm-m68k, SamuraiCrow/llvm-m68k and Peylow/llvm), but those can barely even process trivial straight-line code and are on a par with my own efforts.

So is there another solution that I've missed? There seem to be (at least) three options:

  • Find a port of gcc that supports regparm on m68k and actually pays attention to -fomit-frame-pointer so that it doesn't interfere with the Amiga's standard library-calling convention;
  • Find a more complete m68k backend for LLVM; or
  • Find another compiler that has a decent m68k backend.

I would strongly prefer that the compiler understand C++11, which both GCC and clang support, and can be made to run on MacOS. I can backport my code to C++98 if necessary, but booting up an emulator or VM to run some obscure ancient executables would foul up my workflow.


Edit 2016-05-22 1314 CEST:

rrrzx pointed out vbcc in a comment, so I gave it a spin. The upside is that it supports register parameters and doesn't take A6 for its own purposes, so it can be used to cross-compile Amiga binaries without having to fight the compiler as is the case with gcc. The downside is that it is C-only, and its optimiser and code generator are pretty dire.


Edit 2018-08-18 1817 CEST:

My eventual solution was to bodge regparm support into gcc, and it has proven reliable enough for my purposes. You can find it in the mooli/gcc-amiga repository on GitHub.

  • 5
    I think the path of least resistance is to port the AmigaOS-specific parts of the old GCC 2.95 port up to GCC 4.9, which is the last GCC to natively support m68k (even though the generated code is worse, but that's often not the most important thing.) But it's a good question. I really hope that someone will come up with a great answer. – pipe May 22 '16 at 0:43
  • 2
    I've been using GCC for m68k successfully for my Atari Falcon but I forget which build. I'll check it out later when I'm back on my PC. – Matt Lacey May 22 '16 at 3:07
  • 8
    I was discussing this same problem with a friend last week, and one idea that would be nice is to make a GCC or LLVM backend that will generate compliant oldschool ANSI-C from any high-level language. That file can then be run through the native compiler to generate an executable. This would also be useful for other legacy platforms. – pipe May 22 '16 at 4:43
  • 3
    None of these options may meet your requirements, but for completeness sake, the ones I know are: gcc 2.95 in amigaos-cross-toolchain, gcc 3.4.6 in the netsurf toolchain (but you need to do a little work to enable g++, and is good enough to compile ScummVM 1.8.0 at least), gcc 4.6.4 in the AROS toolchain (ELF files are generated, so you need to run elf2hunk on the executable), and VBCC (C only and C99 support is incomplete). – rcntxtlztn May 22 '16 at 7:05
  • 3
    Commenting as this is more conjecture than an answer, but I read somewhere that pcc - Portable C Compiler - was used to build parts of the very first Amiga OS sources. It was resurrected recently (although I'm not sure if it's very active) at pcc.ludd.ltu.se. I quick nosey at the source code shows that it supports an m68k backend. May be worth a look. – Richard Downer May 23 '16 at 15:27
up vote 10 down vote accepted

Half a year ago, I've started a M680x0 port of LLVM. It is still at an early stage, but currently it is able to emit linkable/relocatable (no tls) object files that can be linked with GNU ld against glibc or newlib. ISA is limited to M68000 but is easily extensible. Also C++ support is rather questionable but if you are familiar with LLVM you can add it.

If interested you can check it out here: https://github.com/M680x0

  • Hi Artyom. We aim to build a lasting repository of knowledge, so answering questions some time after they were posted is usually fine, as long as your answer adds something new. I have proposed an edit to your answer to clean it up a little. I hope you will stay and contribute more to the site! Do feel free to take the quick site tour as well as read through the help center to learn more about how our site and the Stack Exchange network in general works, if you haven't already. – a CVn May 3 '17 at 11:07
  • Oh I see, should this answer be moved into the comment section for the question then? – Artyom Goncharov May 3 '17 at 12:06
  • 1
    I think this is an okay answer to the question as asked. Comments should be used for ephemeral content, generally for suggesting improvements to a post, and can be deleted at almost any time for almost any reason. Questions and answers have much higher bars for deletion. – a CVn May 3 '17 at 12:08
  • So is the C support more or less complete and stable? – JeremyP May 4 '17 at 10:15
  • It can cross-compile GNU Hello (not your average hello world) executable that you can run on Debian m68k port. As far as I can tell this project covers all c98 features, most of it of course is handled by clang itself, but llvm-wise it has everything you need to compile a C program. – Artyom Goncharov May 4 '17 at 11:14

You should try chairwpz, if you didn't already. It manifests as as a decent toolchain for linux/MacOS.

https://github.com/cahirwpz/amigaos-cross-toolchain

  • 2
    Thanks for this! This answer would be even better if you included some information about the software as well; at the moment this is largely a link-only answer (albeit a useful one!). – wizzwizz4 Nov 14 '16 at 17:13

Take a look at https://github.com/bebbo which are GCC 6.3 cross-compiler toolchains for Windows, Linux, and Mac OS X targeting AmigaOS 3. There's an ongoing discussion about it here.

This might help a bunch: I've posted a very detailed guide on how to create (from source) an Amiga OS 4.x / PowerPC "adtools" cross-compiling gcc/g++ 5.4.x toolchain; hosted inside either a Cygwin32/Cygwin64 environment or inside a Bash-on-Ubuntu-on-Windows/Windows Subsystem for Linux environment on Windows 10.

That guide is found here:

How-To Create a Cygwin/Bash-on-Ubuntu-on-Windows adtools (cyg-adtools/uwin-adtools) Cross-Compiling Amiga OS4.x Toolchain on Windows 10

I've also posted another step-by-step guide on how to use that cyg-adtools/uwin-adtools toolchain with MS Visual Studio 2017. That second guide is found here:

Using Visual Studio 2017 with a Cygwin-Based Cross-Compiling Amiga OS 4.x adtools Toolchain on Windows 10

I note both those guides here, because they're brand new instructions published in October of 2017, showing how to build the official "adtools" toolchain for OS4.x, and I think they'll work with only minor changes for the OS3.x toolchain as well -- I've simply not tried, though.

  • 1
    These are great for PPC — but the OP asked about 68k – scruss Oct 19 '17 at 15:42
  • Welcome to Retrocomputing Stack Exchange. Please read the tour. Answers on this site are expected to be self-contained, so could you please provide a summary of your (excellent!) guides in addition to the link to the full version. – wizzwizz4 Oct 19 '17 at 16:06

One approach you may be interested in that I recently saw somebody else using for working on a platform with no modern C or C++ compiler support was to use LLVM in its output-to-C-code mode, and then process the resulting C code through the original native compiler. This apparently meant they could use modern C and C++ features and they were able to benefit from at least some of LLVM's optimization capacity. Might be worth a try.

  • That's a pretty neat idea. But is there a suitable compiler that outputs 68k executables good for AmigaOS. – Wilson Oct 20 '17 at 11:53
  • @Wilson The question mentions vbcc as a possibility except for not supporting modern language versions and poor optimization; this approach would definitely resolve the lack of support for modern standards and would also probably improve the situation regarding optimization. – Jules Oct 21 '17 at 1:05

Try this one though it only runs in windows, unfortunately I don't know what backend it uses: http://amidevcpp.amiga-world.de/index.php?HR_LANG=english

  • 1
    That fails on "booting up an emulator or VM to run some obscure ancient executables would foul up my workflow"; I don't develop on Windows unless somebody is paying me a lot of money to do so. Its business end is Cygwin, so it'll be using gcc, which I have determined is also not suitable. – pndc Jul 17 '16 at 9:56
  • Sorry, I misunderstood that you didn't mind working in a VM. – Carsten Jensen Jul 17 '16 at 14:17

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.