Help building compiler-rt for a new cross target?

Is there a recipe somewhere for setting up the source tree and configuring compiler-rt for cross compilation for a new target. I tried following the instructions I could find, but I can’t get it to actually build. Whether or not the sources are in the llvm tree after running cmake, make just ignores the files in compiler-rt, in particular the files in the builtins directory. They just plain don’t get compiled.

I found bits and pieces online, but nothing that actually seems like an end-to-end recipe.

Thanks for any help.

Hello John,

I don't know of any recipe for cross-compiling for a new target. I'm
intending to write up some recent experience with cross-compiling the
builtins and running tests via qemu for Arm and AArch64 targets. I
don't have any experience in adding a new target though. If I were to
do it myself I'd start by finding the references to an already
supported target that most closely matches the new one and fill it out
from there. You have my sympathies as it took quite a few failed
experiments to get cross-compilation working.

My guess is that your cmake output has a blank for "-- Compiler-RT
supported architectures: ", there are some internal tests in
compiler-rt to check whether your target is supported or not. If you
haven't already set it, I suggest using
-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON and
-DCMAKE_C_COMPILER_TARGET="Your target". The next place I'd check is
whether you need to add your target to lib/builtins/CMakeLists.txt,
I'm not sure if GENERIC_SOURCES are added by default.

I've found the cmake option --trace-expand useful in debugging what is
happening.

Hope this is of some use.

Peter