linux/arch/s390/kernel
Masahiro Yamada a494398bde s390: define RUNTIME_DISCARD_EXIT to fix link error with GNU ld < 2.36
Nathan Chancellor reports that the s390 vmlinux fails to link with
GNU ld < 2.36 since commit 99cb0d917f ("arch: fix broken BuildID
for arm64 and riscv").

It happens for defconfig, or more specifically for CONFIG_EXPOLINE=y.

  $ s390x-linux-gnu-ld --version | head -n1
  GNU ld (GNU Binutils for Debian) 2.35.2
  $ make -s ARCH=s390 CROSS_COMPILE=s390x-linux-gnu- allnoconfig
  $ ./scripts/config -e CONFIG_EXPOLINE
  $ make -s ARCH=s390 CROSS_COMPILE=s390x-linux-gnu- olddefconfig
  $ make -s ARCH=s390 CROSS_COMPILE=s390x-linux-gnu-
  `.exit.text' referenced in section `.s390_return_reg' of drivers/base/dd.o: defined in discarded section `.exit.text' of drivers/base/dd.o
  make[1]: *** [scripts/Makefile.vmlinux:34: vmlinux] Error 1
  make: *** [Makefile:1252: vmlinux] Error 2

arch/s390/kernel/vmlinux.lds.S wants to keep EXIT_TEXT:

        .exit.text : {
                EXIT_TEXT
        }

But, at the same time, EXIT_TEXT is thrown away by DISCARD because
s390 does not define RUNTIME_DISCARD_EXIT.

I still do not understand why the latter wins after 99cb0d917f,
but defining RUNTIME_DISCARD_EXIT seems correct because the comment
line in arch/s390/kernel/vmlinux.lds.S says:

        /*
         * .exit.text is discarded at runtime, not link time,
         * to deal with references from __bug_table
         */

Nathan also found that binutils commit 21401fc7bf67 ("Duplicate output
sections in scripts") cured this issue, so we cannot reproduce it with
binutils 2.36+, but it is better to not rely on it.

Fixes: 99cb0d917f ("arch: fix broken BuildID for arm64 and riscv")
Link: https://lore.kernel.org/all/Y7Jal56f6UBh1abE@dev-arch.thelio-3990X/
Reported-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Link: https://lore.kernel.org/r/20230105031306.1455409-1-masahiroy@kernel.org
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
2023-01-06 16:38:21 +01:00
..
syscalls
vdso32
vdso64
.gitignore
abs_lowcore.c s390/smp: rework absolute lowcore access 2022-09-14 16:46:00 +02:00
alternative.c
asm-offsets.c s390/entry: sort out physical vs virtual pointers usage in sie64a 2022-10-26 14:27:41 +02:00
audit.c
audit.h
cache.c
compat_audit.c
compat_linux.c
compat_linux.h
compat_ptrace.h
compat_signal.c
cpcmd.c
cpufeature.c s390/uvdevice: autoload module based on CPU facility 2022-07-19 16:18:49 +02:00
crash_dump.c iov_iter work; most of that is about getting rid of 2022-12-12 18:29:54 -08:00
debug.c s390/debug: remove function type cast 2022-11-23 16:24:07 +01:00
diag.c
dis.c
dumpstack.c
early.c s390: move from strlcpy with unused retval to strscpy 2022-08-30 22:00:33 +02:00
early_printk.c
earlypgm.S
ebcdic.c
entry.h
entry.S ARM64: 2022-12-15 11:12:21 -08:00
fpu.c s390/vx: add vx-insn.h wrapper include file 2022-12-06 16:18:23 +01:00
ftrace.c
ftrace.h
guarded_storage.c
head64.S
idle.c
ima_arch.c
ipl.c s390/ipl: use octal values instead of S_* macros 2022-12-06 16:18:22 +01:00
ipl_vmparm.c
irq.c
jump_label.c
kdebugfs.c
kexec_elf.c
kexec_image.c
kprobes.c s390/kprobes: define insn cache ops within private header file 2022-11-23 16:24:07 +01:00
kprobes.h s390/kprobes: define insn cache ops within private header file 2022-11-23 16:24:07 +01:00
kprobes_insn_page.S
lgr.c
machine_kexec.c s390/smp: rework absolute lowcore access 2022-09-14 16:46:00 +02:00
machine_kexec_file.c
machine_kexec_reloc.c
Makefile Kbuild updates for v6.1 2022-10-10 12:00:45 -07:00
mcount.S
module.c
nmi.c s390/nmi: get rid of private slab cache 2022-12-06 16:18:26 +01:00
nospec-branch.c
nospec-sysfs.c
numa.c
os_info.c s390/mm: uninline copy_oldmem_kernel() function 2022-09-14 16:46:01 +02:00
perf_cpum_cf.c perf: Use sample_flags for raw_data 2022-09-27 22:50:24 +02:00
perf_cpum_cf_common.c
perf_cpum_cf_events.c
perf_cpum_sf.c
perf_event.c
perf_pai_crypto.c Perf events updates for v6.2: 2022-12-12 15:19:38 -08:00
perf_pai_ext.c Perf events updates for v6.2: 2022-12-12 15:19:38 -08:00
perf_regs.c
process.c treewide: use get_random_u32_below() instead of deprecated function 2022-11-18 02:15:15 +01:00
processor.c
ptrace.c
reipl.S
relocate_kernel.S
runtime_instr.c
setup.c random: do not include <asm/archrandom.h> from random.h 2022-12-20 03:13:45 +01:00
signal.c
smp.c s390/mm: uninline copy_oldmem_kernel() function 2022-09-14 16:46:01 +02:00
stacktrace.c
sthyi.c
syscall.c
sysinfo.c
text_amode31.S
time.c
topology.c
trace.c
traps.c
unwind_bc.c
uprobes.c
uv.c KVM: s390: pv: avoid export before import if possible 2022-11-23 09:06:50 +00:00
vdso.c Random number generator updates for Linux 6.2-rc1. 2022-12-12 16:22:22 -08:00
vmlinux.lds.S s390: define RUNTIME_DISCARD_EXIT to fix link error with GNU ld < 2.36 2023-01-06 16:38:21 +01:00
vtime.c