Here are some notes on building/testing LLVM/Clang on ARM. Note that
ARM encompasses a wide variety of CPUs; this advice is primarily based
on the ARMv6 and ARMv7 architectures and may be inapplicable to older chips.

The most popular Linaro/Ubuntu OS’s for ARM boards, e.g., the
Pandaboard, have become hard-float platforms. There are a number of
choices when using CMake. Autoconf usage is deprecated as of 3.8.

Building LLVM/Clang in Relese mode is preferred since it consumes
a lot less memory. Otherwise, the building process will very likely
fail due to insufficient memory. It’s also a lot quicker to only build
the relevant back-ends (ARM and AArch64), since it’s very unlikely that
you’ll use an ARM board to cross-compile to other arches. If you’re
running Compiler-RT tests, also include the x86 back-end, or some tests
will fail.

After that, just typing make-jN or ninja will build everything.
make-jNcheck-all or ninjacheck-all will run all compiler tests. For
running the test suite, please refer to LLVM Testing Infrastructure Guide.

If you are building LLVM/Clang on an ARM board with 1G of memory or less,
please use gold rather then GNU ld. In any case it is probably a good
idea to set up a swap partition, too.

$ sudo ln -sf /usr/bin/ld /usr/bin/ld.gold

ARM development boards can be unstable and you may experience that cores
are disappearing, caches being flushed on every big.LITTLE switch, and
other similar issues. To help ease the effect of this, set the Linux
scheduler to “performance” on all cores using this little script:

Remember to turn that off after the build, or you may risk burning your
CPU. Most modern kernels don’t need that, so only use it if you have
problems.

Running the build on SD cards is ok, but they are more prone to failures
than good quality USB sticks, and those are more prone to failures than
external hard-drives (those are also a lot faster). So, at least, you
should consider to buy a fast USB stick. On systems with a fast eMMC,
that’s a good option too.

Make sure you have a decent power supply (dozens of dollars worth) that can
provide at least 4 amperes, this is especially important if you use USB
devices with your board. Externally powered USB/SATA harddrives are even
better than having a good power supply.