Skip to content
This repository was archived by the owner on Oct 4, 2023. It is now read-only.

Commit 4594c5a

Browse files
author
greenforce-auto-build
committed
greenforce: Bump to 20221213 build
Clang version: Binutils version: 2.34 LLVM repo commit: [NFC] Replaces: BB->getInstList().erase(I) with I->eraseFromParent(). Link: llvm/llvm-project@4c5469e2c Signed-off-by: greenforce-auto-build <[email protected]> Change-Id: I9aeb9ed8437c9398526a870f99eeb8d88b206081
0 parents  commit 4594c5a

File tree

405 files changed

+159597
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

405 files changed

+159597
-0
lines changed

README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Greenforce Clang
2+
3+
## Host compatibility
4+
5+
This toolchain is built on Ubuntu 20.04, which uses glibc 2.31. Compatibility with older distributions cannot be guaranteed. Other libc implementations (such as musl) are not supported.
6+
7+
## Building Linux
8+
9+
Make sure you have this toolchain in your `PATH`:
10+
11+
```bash
12+
export PATH="$HOME/toolchains/clang-llvm/bin:$PATH"
13+
```
14+
15+
For an AArch64 cross-compilation setup, you must set the following variables. Some of them can be environment variables, but some must be passed directly to `make` as a command-line argument. It is recommended to pass **all** of them as `make` arguments to avoid confusing errors:
16+
17+
- `CC=clang` (must be passed directly to `make`)
18+
- `CROSS_COMPILE=aarch64-linux-gnu-`
19+
- If your kernel has a 32-bit vDSO: `CROSS_COMPILE_ARM32=arm-linux-gnueabi-`
20+
21+
Optionally, you can also choose to use as many LLVM tools as possible to reduce reliance on binutils. All of these must be passed directly to `make`:
22+
23+
- `AR=llvm-ar`
24+
- `NM=llvm-nm`
25+
- `OBJCOPY=llvm-objcopy`
26+
- `OBJDUMP=llvm-objdump`
27+
- `STRIP=llvm-strip`
28+
29+
Note, however, that additional kernel patches may be required for these LLVM tools to work. It is also possible to replace the binutils linkers (`lf.bfd` and `ld.gold`) with `lld` and use Clang's integrated assembler for inline assembly in C code, but that will require many more kernel patches and it is currently impossible to use the integrated assembler for *all* assembly code in the kernel.
30+
31+
Android kernels older than 4.14 will require patches for compiling with any Clang toolchain to work; those patches are out of the scope of this project. See [android-kernel-clang](https://github.com/nathanchance/android-kernel-clang) for more information.
32+
33+
Android kernels 4.19 and newer use the upstream variable `CROSS_COMPILE_COMPAT`. When building these kernels, replace `CROSS_COMPILE_ARM32` in your commands and scripts with `CROSS_COMPILE_COMPAT`.
34+
35+
### Differences from other toolchains
36+
37+
Greenforce Clang has been designed to be easy-to-use compared to other toolchains, such as [AOSP Clang](https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/). The differences are as follows:
38+
39+
- `CLANG_TRIPLE` does not need to be set because we don't use AOSP binutils.
40+
- `LD_LIBRARY_PATH` does not need to be set because we set library load paths in the toolchain.
41+
- No separate GCC/binutils toolchains are necessary; all tools are bundled.
42+
43+
#### Additional patches
44+
45+
To use full Clang LTO with Greenforce Clang, you have to cherry-pick [ANDROID: generate_initcall_order.pl: Use two dash long options for llvm-nm](https://android.googlesource.com/kernel/common.git/+/240f2f8f42f57b46788379e0072836cb2cb40c8c) otherwise your kernel will not boot.

aarch64-linux-gnu/bin/ar

1.25 MB
Binary file not shown.

aarch64-linux-gnu/bin/as

2.28 MB
Binary file not shown.

aarch64-linux-gnu/bin/ld

2.78 MB
Binary file not shown.

aarch64-linux-gnu/bin/ld.bfd

2.78 MB
Binary file not shown.

aarch64-linux-gnu/bin/ld.gold

5.4 MB
Binary file not shown.

aarch64-linux-gnu/bin/nm

1.23 MB
Binary file not shown.

aarch64-linux-gnu/bin/objcopy

1.37 MB
Binary file not shown.

aarch64-linux-gnu/bin/objdump

2.6 MB
Binary file not shown.

aarch64-linux-gnu/bin/ranlib

1.25 MB
Binary file not shown.

0 commit comments

Comments
 (0)