[Android Software/Hacking General [Developers Only]] m_vaisakh:
Introducing Eva GCC Toolchain

What is GCC?​

What is LLVM Clang?​

Introduction
​

Android as a whole has now fully switched to LLVM Clang for both their Platform (AOSP) and Kernels. In fact Pixel Phones have been shipping with Clang built and optimised kernels since 2018! But are there any improvements with using clang over GCC. I'd say yes, because the GCC that AOSP used was ancient (GCC 4.9). Also LLVM Clang has proven to be faster in compilation than GCC. But is this speed worth the improvement in Kernels? Let's answer that question with EvaGCC Toolchain.

How is my toolchain different from Android GCC?
​

As I've mentioned earlier, AOSP GCC is ancient (version 4.9) in terms of the present stable GCC release (10.2.x). EvaGCC is compiled straight from the Master branch, making it a Bleeding Edge C Compiler. It is built with LTO and disabled a lot of feature bloat that are unneccesary for kernel building to yield a very small binary size. To list the features:

Bare Metal GCC (This does not depend on the standard libc)​

Built straight from the GNU GCC Master branch​

Built with LTO and O3 optimisations​

Disabled documentation (Smaller size of the toolchain)​

Disabled decimal float, libffi, libmudflap, libquadmath, libstdcxx-pch, native language support​

Statically linked GCC​

Integrated LLVM LLD (For faster linking, optional)​

Built twice weekly (Thanks to Github Actions!)​

Where can I find these toolchains?​

Well you have two options, you can compile them yourself (by using my script) or you can download precompiled binaries!

To compile this toolchain by yourself (although I recommend that you use precompiled binaries, to avoid the hassle and time to compile the toolchain itself), to use my script to compile your toolchain, it has everything preconfigured for GCC setup and cloning. Although you'll have to setup your system for building GCC, you can refer to my README for system setup.

Note:

To obtain precompiled binaries (Highly recommended), head over to these links (according to your architechture and liking):

ARM Git Repository with Precompiled Binaries

ARM precompiled binaries in a compressed zip (direct download)

AARCH64 (ARM64) Git Repository with Precompiled Binaries

AARCH64 (ARM64) precompiled binaries in a compressed zip (direct download)

Note: If you're doing a git clone, use --depth=1 to avoid heavy transfers, because the repositories are bound get bigger with subsequent updates.

How do I use these toolchains for compiling my kernel​

You can either append the toolchain dir into your PATH variable, or you can just pass it along with make with setting your CROSS_COMPILE argument. I usually use the latter one.

Since this is a bare metal compiler, the prefix differs from the normal AOSP or Linux GNU GCC. the prefix is:

# Pass this to your CROSS_COMPILE argument if you have appended toolchain to your PATH
## for AARCH64 or ARM64
$ make CROSS_COMPILE=aarch64-elf- ... # "..." indicates rest of your args

## for ARM
$ make CROSS_COMPILE=arm-eabi- ...

# Passing to make when you haven't appended to PATH
## for AARCH64 or ARM64
$ make CROSS_COMPILE=<path to toolchain>/bin/aarch64-elf- ...

## for ARM
$ make CROSS_COMPILE=path to toolchain>/bin/arm-eabi- ...

Sources:

Everything here is OSS, including the script, my ci automation script.

GCC: https://gcc.gnu.org/git/?p=gcc.git or https://git.linaro.org/toolchain/gcc.git

Binutils: https://sourceware.org/git/binutils-gdb.git

GCC Build script: https://github.com/mvaisakh/gcc-build

LLVM (Used for LLD): https://github.com/llvm/llvm-project

GCC Version: 13.x

Binutils Version: 2.36.x

LLD Version: 16.x

Telegram Channel:

Eva GCC

Bleeding Edge Bare Metal GCC, primarily targeting Android kernels.

t.me