android_kernel_samsung_sm8650/arch/x86
Song Liu 0dea068499 x86/purgatory: Remove LTO flags
[ Upstream commit 75b2f7e4c9e0fd750a5a27ca9736d1daa7a3762a ]

-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:11:09 +02:00
..
boot x86/boot/compressed: Reserve more memory for page tables 2023-09-23 11:11:09 +02:00
coco x86/tdx: Fix race between set_memory_encrypted() and load_unaligned_zeropad() 2023-07-19 16:21:00 +02:00
configs x86/defconfig: Enable CONFIG_DEBUG_WX=y 2022-09-02 10:41:42 +02:00
crypto crypto: x86/ghash - fix unaligned access in ghash_setkey() 2023-03-10 09:32:51 +01:00
entry x86/mm: Fix VDSO and VVAR placement on 5-level paging machines 2023-08-16 18:27:25 +02:00
events perf/x86/uncore: Correct the number of CHAs on EMR 2023-09-13 09:43:04 +02:00
hyperv x86/hyperv: Disable IBT when hypercall page lacks ENDBR instruction 2023-08-11 12:08:21 +02:00
ia32
include x86/boot/compressed: Reserve more memory for page tables 2023-09-23 11:11:09 +02:00
kernel x86/sgx: Break up long non-preemptible delays in sgx_vepc_release() 2023-09-13 09:43:04 +02:00
kvm KVM: SVM: Skip VMSA init in sev_es_init_vmcb() if pointer is NULL 2023-09-19 12:28:07 +02:00
lib x86/retpoline,kprobes: Fix position of thunk sections with CONFIG_LTO_CLANG 2023-08-26 13:27:00 +02:00
math-emu
mm x86/sev: Make enc_dec_hypercall() accept a size instead of npages 2023-09-13 09:43:03 +02:00
net bpf: Remove prog->active check for bpf_lsm and bpf_iter 2023-09-19 12:28:03 +02:00
pci x86/pci/xen: populate MSI sysfs entries 2023-05-30 14:03:22 +01:00
platform x86/efi: Make efi_set_virtual_address_map IBT safe 2023-07-19 16:21:45 +02:00
power x86/pm: Add enumeration check before spec MSRs save/restore setup 2022-11-21 14:16:16 +01:00
purgatory x86/purgatory: Remove LTO flags 2023-09-23 11:11:09 +02:00
ras
realmode x86/boot: Skip realmode init code when running as Xen PV guest 2022-12-31 13:32:16 +01:00
tools x86/tools/relocs: Ignore __kcfi_typeid_ relocations 2022-09-26 10:13:15 -07:00
um x86: um: vdso: Add '%rcx' and '%r11' to the syscall clobber list 2023-03-11 13:55:22 +01:00
video
virt/vmx/tdx
xen x86/xen: Fix secondary processors' FPU initialization 2023-08-08 20:03:49 +02:00
.gitignore x86/purgatory: Omit use of bin2c 2022-07-25 10:32:32 +02:00
Kbuild
Kconfig x86/srso: Add a Speculative RAS Overflow mitigation 2023-08-08 20:03:50 +02:00
Kconfig.assembler
Kconfig.cpu
Kconfig.debug arch: make TRACE_IRQFLAGS_NMI_SUPPORT generic 2022-06-23 15:39:21 +01:00
Makefile x86/build: Move '-mindirect-branch-cs-prefix' out of GCC-only block 2023-02-09 11:28:13 +01:00
Makefile_32.cpu
Makefile.um um: Only disable SSE on clang to work around old GCC bugs 2023-05-01 08:26:27 +09:00