Skip to content

arm64, x86_64: why are CONFIG_LTO_CLANG_FULL kernels much bigger? #1643

@michaelopdenacker

Description

@michaelopdenacker

Greetings

I expected the LTO optimized kernels to be smaller because of the elimination of dead code, as described on https://www.llvm.org/docs/LinkTimeOptimization.html

However, the LTO optimized compressed kernels are actually bigger.

On arm64, Linux 5.18-rc7, defconfig configuration, the Image.gz file size is:
using gcc 12: 12149327 bytes
using clang 14 with CONFIG_LTO_NONE=y: 12197028 bytes
using clang 14 without CONFIG_LTO_CLANG_THIN: 12419217 bytes
using clang 14 with CONFIG_LTO_CLANG_FULL: 16097599 bytes

On x86_64, Linux 5.18-rc7, x86_64_defconfig configuration file, the bzImage file size is:
using gcc 12: 10743648 bytes
using clang 14 with CONFIG_LTO_NONE=y: 11011008 bytes
using clang without CONFIG_LTO_CLANG_THIN: 11166720 bytes
using clang 14 with CONFIG_LTO_CLANG_FULL:13650880 bytes

How would you explain that the LTO_THIN and above all the LTO_FULL optimized kernels are actually bigger than the LTO_NONE ones, at least on the x86_64 and arm64 architectures?

Thanks in advance for your insights.
Cheers
Michael.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionQuestion asked by issue author.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions