linux-stable/arch
Song Liu 58787ff3d0 x86/purgatory: Remove LTO flags
[ Upstream commit 75b2f7e4c9 ]

-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
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-09-23 11:10:01 +02:00
..
alpha alpha: remove __init annotation from exported page_is_ram() 2023-08-16 18:22:03 +02:00
arc ARC: atomics: Add compiler barrier to atomic operations... 2023-09-19 12:23:00 +02:00
arm ARM: 9317/1: kexec: Make smp stop calls asynchronous 2023-09-23 11:09:58 +02:00
arm64 arm64: dts: qcom: sm8250-edo: correct ramoops pmsg-size 2023-09-23 11:09:57 +02:00
csky
h8300
hexagon
ia64 ia64/cpu: Switch to arch_cpu_finalize_init() 2023-08-08 19:58:30 +02:00
m68k m68k: Fix invalid .section syntax 2023-09-19 12:22:27 +02:00
microblaze
mips MIPS: Use "grep -E" instead of "egrep" 2023-09-23 11:10:00 +02:00
nds32
nios2 nios2: dts: Fix tse_mac "max-frame-size" property 2023-06-21 15:59:14 +02:00
openrisc openrisc: Properly store r31 to pt_regs on unhandled exceptions 2023-05-11 23:00:37 +09:00
parisc parisc: led: Fix LAN receive and transmit LEDs 2023-09-19 12:22:55 +02:00
powerpc powerpc/pseries: fix possible memory leak in ibmebus_bus_init() 2023-09-23 11:09:58 +02:00
riscv riscv: uaccess: Return the number of bytes effectively not copied 2023-08-26 14:23:36 +02:00
s390 s390/ipl: add missing secure/has_secure file to ipl type 'unknown' 2023-09-19 12:22:52 +02:00
sh sh: boards: Fix CEU buffer size passed to dma_declare_coherent_memory() 2023-09-19 12:23:00 +02:00
sparc sparc/cpu: Switch to arch_cpu_finalize_init() 2023-08-08 19:58:31 +02:00
um um: Fix hostaudio build errors 2023-09-19 12:22:49 +02:00
x86 x86/purgatory: Remove LTO flags 2023-09-23 11:10:01 +02:00
xtensa xtensa: PMU: fix base address for the newer hardware 2023-09-19 12:22:51 +02:00
.gitignore
Kconfig init: Provide arch_cpu_finalize_init() 2023-08-08 19:58:30 +02:00