1 |
On 20/07/25 11:00AM, Benda Xu wrote: |
2 |
> Gunwant Jain <therealgunwant@×××××.com> writes: |
3 |
> |
4 |
> > Yes it did. |
5 |
> > I can also report that llvm_android's stage1 clang is compiled for |
6 |
> > aarch64, I am on the stage2 step currently. |
7 |
> |
8 |
> Good. Could you please remind me of the meanings of llvm stage1 and |
9 |
> stage2? |
10 |
|
11 |
Sure. AOSP provides its own distribution of LLVM. So most of what stage1 |
12 |
and stage2 I will be describing could be taken from [1]. |
13 |
Basically, we build LLVM stage1 using our own host toolchain. Then we |
14 |
use the newly built stage1 compiler to build stage2, the ready to use |
15 |
toolchain. |
16 |
|
17 |
Coming to how this goes in our use-case, if we were to build the LLVM |
18 |
toolchain using llvm_android (basically just build scripts), we will use |
19 |
a prebuilt Clang toolchain, bundled with llvm_android to build stage1. |
20 |
Also AOSP targets only X86 architechture in stage1. |
21 |
After stage1 is built, the build script proceeds to start building |
22 |
stage2. This is where we use the newly built stage1 compilers to build |
23 |
stage2 compilers. AOSP targets AArch64, ARM, X86 and BPF when building |
24 |
stage2. Then the build script packages stage2 install and dumps the tar |
25 |
for our use. |
26 |
|
27 |
In the cycle of AOSP development, this newly packaged stage2 will be |
28 |
provided as the prebuilt LLVM toolchain in [2]. This repository is used: |
29 |
- In the AOSP tree, when someone builds a new custom ROM. |
30 |
- In llvm_android as the prebuilt toolchain used to build a version |
31 |
bumped stage1. |
32 |
|
33 |
For us, we will have to target AArch64 in building both stage1 and |
34 |
stage2. |
35 |
|
36 |
|
37 |
Regards, |
38 |
Gunwant |
39 |
|
40 |
[1] https://llvm.org/docs/BuildingADistribution.html |
41 |
[2] https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/ |