linux/arch/x86/purgatory
Song Liu 75b2f7e4c9 x86/purgatory: Remove LTO flags
-flto* implies -ffunction-sections. With LTO enabled, ld.lld generates
multiple .text sections for purgatory.ro:

  $ readelf -S purgatory.ro  | grep " .text"
    [ 1] .text             PROGBITS         0000000000000000  00000040
    [ 7] .text.purgatory   PROGBITS         0000000000000000  000020e0
    [ 9] .text.warn        PROGBITS         0000000000000000  000021c0
    [13] .text.sha256_upda PROGBITS         0000000000000000  000022f0
    [15] .text.sha224_upda PROGBITS         0000000000000000  00002be0
    [17] .text.sha256_fina PROGBITS         0000000000000000  00002bf0
    [19] .text.sha224_fina PROGBITS         0000000000000000  00002cc0

This causes WARNING from kexec_purgatory_setup_sechdrs():

  WARNING: CPU: 26 PID: 110894 at kernel/kexec_file.c:919
  kexec_load_purgatory+0x37f/0x390

Fix this by disabling LTO for purgatory.

[ AFAICT, x86 is the only arch that supports LTO and purgatory. ]

We could also fix this with an explicit linker script to rejoin .text.*
sections back into .text. However, given the benefit of LTOing purgatory
is small, simply disable the production of more .text.* sections for now.

Fixes: b33fff07e3 ("x86, build: allow LTO to be selected")
Signed-off-by: Song Liu <song@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Sami Tolvanen <samitolvanen@google.com>
Link: https://lore.kernel.org/r/20230914170138.995606-1-song@kernel.org
2023-09-17 09:49:03 +02:00
..
.gitignore x86/purgatory: Fail the build if purgatory.ro has missing symbols 2020-03-17 15:59:12 +01:00
entry64.S x86/asm/purgatory: Start using annotations 2019-10-18 10:48:43 +02:00
kexec-purgatory.S x86/purgatory: Omit use of bin2c 2022-07-25 10:32:32 +02:00
Makefile x86/purgatory: Remove LTO flags 2023-09-17 09:49:03 +02:00
purgatory.c x86/purgatory: Include header for warn() declaration 2023-08-03 16:37:18 +02:00
setup-x86_64.S x86/asm/purgatory: Start using annotations 2019-10-18 10:48:43 +02:00
stack.S x86/asm/purgatory: Start using annotations 2019-10-18 10:48:43 +02:00