Getting started

The MOS target is still considered experimental (and unfinished!), so you need to pass  to cmake in order to actually build the new target. If you like, you can speed up the build by disabling the other targets:

It's early days for Clang and the LLVM code generator, but the assembler and linker (LLD) are both MVP complete. Both use ELF as their object format; the target-specific ELF definitions were extended to accommodate the 6502.

No libraries or platform support are included with the llvm-mos repository, to keep it a clean fork of LLVM. These are contained in the related llvm-mos-sdk. The default mos target will only use compiler built-in include and library paths (e.g., stdint.h), so the compiler can be used without the SDK. However, the various platform subtargets (e.g. apple2e, c64, etc) used by the compiler driver will require the SDK to be present. See the SDK for more information as it develops.

Getting the Source Code and Building
The LLVM Getting Started documentation may be out of date. The Clang Getting Started page might have more accurate information.

This is an example work-flow and configuration to get and build the LLVM source:


 * 1) Checkout LLVM (including related sub-projects like Clang):
 * 2) * Or, on windows,
 * 3) Configure and build LLVM and Clang:
 * 4) *   Some common build system generators are:
 * 5) **  --- for generating Ninja build files. Most llvm developers use Ninja.
 * 6) **  --- for generating make-compatible parallel makefiles.
 * 7) **  --- for generating Visual Studio projects and solutions.
 * 8) **  --- for generating Xcode projects.  Some Common options:
 * 9) **  --- semicolon-separated list of the LLVM sub-projects you'd like to additionally build. Can include any of: clang, clang-tools-extra, libcxx, libcxxabi, libunwind, lldb, compiler-rt, lld, polly, or debuginfo-tests.  For example, to build LLVM, Clang, libcxx, and libcxxabi, use.
 * 10) **  --- Specify for directory the full path name of where you want the LLVM tools and libraries to be installed (default  ).
 * 11) **  --- Valid options for type are Debug, Release, RelWithDebInfo, and MinSizeRel. Default is Debug.
 * 12) **  --- Compile with assertion checks enabled (default is Yes for Debug builds, No for all other build types).
 * 13) *  or your build system specified above directly.
 * 14) ** The default target (i.e.  or  ) will build all of LLVM.
 * 15) ** The  target (i.e.  ) will run the regression tests to ensure everything is in working order.
 * 16) ** CMake will generate targets for each tool and library, and most LLVM sub-projects generate their own  target.
 * 17) ** Running a serial build will be slow. To improve speed, try running a parallel build. That's done by default in Ninja; for, use the option  , where   is the number of parallel jobs, e.g. the number of CPUs you have.
 * 18) * For more information see CMake
 * 1) ** Running a serial build will be slow. To improve speed, try running a parallel build. That's done by default in Ninja; for, use the option  , where   is the number of parallel jobs, e.g. the number of CPUs you have.
 * 2) * For more information see CMake

Consult the Getting Started with LLVM page for detailed information on configuring and compiling LLVM. You can visit Directory Layout to learn about the layout of the source code tree.