Skip to content

Instantly share code, notes, and snippets.

@allbinmani
Last active October 25, 2017 08:46
Show Gist options
  • Save allbinmani/6ab217980c3256e9d319581622b0e2fd to your computer and use it in GitHub Desktop.
Save allbinmani/6ab217980c3256e9d319581622b0e2fd to your computer and use it in GitHub Desktop.

Building the M680x0 LLVM backend

Thes instructions have been tested on OSX, but should work just as fine on Linux.

Requirements

Required:

- CMake
- clang

Optional

- GMake (for parallel build)

Clone the repo

git clone git@github.com:allbinmani/M680x0-llvm.git

Create build dir

mkdir builddir && cd builddir

Configure and run cmake

CMake, single process

cmake -DLLVM_TARGET_ARCH="m68k" -DLLVM_TARGETS_TO_BUILD="M680x0" ../M680x0-llvm/ && cmake --build .

CMake + Make, multiple processes

cmake -DLLVM_TARGET_ARCH="m68k" -DLLVM_TARGETS_TO_BUILD="M680x0" -G "Unix Makefiles" ../M680x0-llvm/ && make -j 4

Test-compile

echo 'int main(int argc, char **argv) {return 0;}' >main.c clang -S -c main.c -emit-llvm -o - | ./bin/llc -mtriple=m68k=amiga-m680x0

Amiga-specific modifications

All assemblers I have tried for the Amiga do not accept semicolons as comments, and does not seem to have options for it, which seems strange to me.. Anyway, to get # as a coment character, I had to patch /lib/Target/M680x0/MCTargetDesc/M680x0MCAsmInfo.cpp and change the CommentString definition:

M680x0ELFMCAsmInfo::M680x0ELFMCAsmInfo(const Triple &T) {
  
  ...
  
  CommentString = "#";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment