I am sorry to add on like this, but if it was not mentioned, I am not using any prebuilt repository AOSP bundled with llvm_android. This is the reason why I spent the time emerging Clang on my phone; for using it to build stage1. Although if advised otherwise, I could potentially break the AOSP development cycle for our use and start the same cycle but with prebuilt LLVM toolchain for AArch64 host instead of X86. I could expand on how to do this, if you would like. On 20/07/25 01:33PM, Gunwant Jain wrote: > On 20/07/25 11:00AM, Benda Xu wrote: > > Gunwant Jain writes: > > > > > Yes it did. > > > I can also report that llvm_android's stage1 clang is compiled for > > > aarch64, I am on the stage2 step currently. > > > > Good. Could you please remind me of the meanings of llvm stage1 and > > stage2? > > Sure. AOSP provides its own distribution of LLVM. So most of what stage1 > and stage2 I will be describing could be taken from [1]. > Basically, we build LLVM stage1 using our own host toolchain. Then we > use the newly built stage1 compiler to build stage2, the ready to use > toolchain. > > Coming to how this goes in our use-case, if we were to build the LLVM > toolchain using llvm_android (basically just build scripts), we will use > a prebuilt Clang toolchain, bundled with llvm_android to build stage1. > Also AOSP targets only X86 architechture in stage1. > After stage1 is built, the build script proceeds to start building > stage2. This is where we use the newly built stage1 compilers to build > stage2 compilers. AOSP targets AArch64, ARM, X86 and BPF when building > stage2. Then the build script packages stage2 install and dumps the tar > for our use. > > In the cycle of AOSP development, this newly packaged stage2 will be > provided as the prebuilt LLVM toolchain in [2]. This repository is used: > - In the AOSP tree, when someone builds a new custom ROM. > - In llvm_android as the prebuilt toolchain used to build a version > bumped stage1. > > For us, we will have to target AArch64 in building both stage1 and > stage2. > > > Regards, > Gunwant > > [1] https://llvm.org/docs/BuildingADistribution.html > [2] https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/