From x86_64 to AArch64 on Linux. Without:<p><pre><code> - Relying on GCC, but glibc is ok.
- Recompiling LLVM for AArch64.
- Recompiling LLVM for x86_64 but during that compilation process using whatever is in
clang/cmake/caches, so that runtime stuff like compiler-rt gets compiled for both
x86_64 and AArch64. Without that.
- Without using Zig.
- Without using build setups based on CMake, Meson, Autotools, or Makefiles.
</code></pre>
I looked in many places but couldn't find anything helpful. If you think you know how to do this but never done it, then you are probably wrong, it is not straightforward. To clarify why I want to do this:<p>1. LLVM toolchain can be used independetly of GCC, so even though I have a working GCC cross-compiler, I don't want to use it to supply missing bits, because missing bits can be supplied in other ways. Missing bits are the linker, runtime library, libc++, libc++abi. I'm concerned only with C though.<p>2. Clang is a native cross-compiler, cross-compiling it to AArch64 is missing the point.<p>3. I'm NOT going to rebuild the whole LLVM monstrosity, it is impractical. It literally freezes my laptop for 1+ day. I aborted complitation. It is ok to recompile something small like compiler-rt but then the question is how to use in a non-hacky way because Clang keeps looking for complier-rt related stuff in it's own directory as installed by my Linux distribution (Arch Linux by the way), and -L and -I flags do not help.<p>4. Zig can cross-compile C with just one option without any preparation but I don't know how to pass flags to Clang via zig command line interface. For example I cant pass -O0.<p>5. These are useful for bigger projects, here I'm just interested in cross-compiling hello world.<p>Please do not give links to anything you might find in the official LLVM docs, youtube, first few pages of search engine results. I know about it.