Skip to content
unhappy-ending edited this page Jun 9, 2024 · 2 revisions

Using Clang and the LLVM toolchain system wide in Gentoo is experimental. It's been possible to use the toolchain for many years, however there isn't a lot of in depth information for it. The Gentoo Wiki itself is great for getting started and should be read before trying to tackle the enormous hurdle of using Clang system wide, especially when serving an extra side of rice. Unfortunately, there's a lot of stuff outside the scope of the Gentoo Wiki to cover, such as optimization flags unique to Clang.

Some code gen flags to help optimize file size:

Gentoo defaults:

`stat /usr/bin/ninja-reference` `Size: 283736 Blocks: 560 IO Block: 4096 regular file`

-fdata-sections:

`stat /usr/bin/ninja-reference` `File: /usr/bin/ninja-reference` `Size: 283736 Blocks: 560 IO Block: 4096 regular file`

-ffunction-sections:

`stat /usr/bin/ninja-reference` `File: /usr/bin/ninja-reference` `Size: 283736 Blocks: 560 IO Block: 4096 regular file`

-Wl,--gc-sections: decrease of 1.00%

`stat /usr/bin/ninja-reference` `File: /usr/bin/ninja-reference` `Size: 283344 Blocks: 560 IO Block: 4096 regular file`

-Wl,--icf=all: decrease of 1.08%

`stat /usr/bin/ninja-reference` `File: /usr/bin/ninja-reference` `Size: 263176 Blocks: 520 IO Block: 4096 regular file`

-Wl,-O2: decrease of 1.00%

`stat /usr/bin/ninja-reference` `File: /usr/bin/ninja-reference` `Size: 283464 Blocks: 560 IO Block: 4096 regular file`

-fdata-sections -Wl,--gc-sections: decrease of

-fdata-sections -ffunction-sections -Wl,--gc-sections: decrease of 1.04%

`stat /usr/bin/ninja-reference` `File: /usr/bin/ninja-reference` `Size: 273768 Blocks: 536 IO Block: 4096 regular file`

Clone this wiki locally