• Nicholas Piggin's avatar
    kbuild: allow archs to select link dead code/data elimination · b67067f1
    Nicholas Piggin authored
    Introduce LD_DEAD_CODE_DATA_ELIMINATION option for architectures to
    select to build with -ffunction-sections, -fdata-sections, and link
    with --gc-sections. It requires some work (documented) to ensure all
    unreferenced entrypoints are live, and requires toolchain and build
    verification, so it is made a per-arch option for now.
    
    On a random powerpc64le build, this yelds a significant size saving,
    it boots and runs fine, but there is a lot I haven't tested as yet, so
    these savings may be reduced if there are bugs in the link.
    
        text      data        bss        dec   filename
    11169741   1180744    1923176	14273661   vmlinux
    10445269   1004127    1919707	13369103   vmlinux.dce
    
    ~700K text, ~170K data, 6% removed from kernel image size.
    Signed-off-by: default avatarNicholas Piggin <npiggin@gmail.com>
    Signed-off-by: default avatarMichal Marek <mmarek@suse.com>
    b67067f1
Makefile 1.17 KB