[PATCH 04/11] s390: vmlinux.lds.S: Discard unnecessary sections

From: Nathan Chancellor
Date: Wed Feb 07 2024 - 19:16:08 EST


When building with CONFIG_LD_ORPHAN_WARN after selecting
CONFIG_ARCH_HAS_LD_ORPHAN_WARN, there are some warnings around certain
ELF sections that are unnecessary for the kernel's purposes.

s390-linux-ld: warning: orphan section `.dynstr' from `arch/s390/kernel/head64.o' being placed in section `.dynstr'
s390-linux-ld: warning: orphan section `.dynamic' from `arch/s390/kernel/head64.o' being placed in section `.dynamic'
s390-linux-ld: warning: orphan section `.hash' from `arch/s390/kernel/head64.o' being placed in section `.hash'
s390-linux-ld: warning: orphan section `.gnu.hash' from `arch/s390/kernel/head64.o' being placed in section `.gnu.hash'

Add them to the discards to clear up the warnings, which matches other
architectures.

Signed-off-by: Nathan Chancellor <nathan@xxxxxxxxxx>
---
arch/s390/kernel/vmlinux.lds.S | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/s390/kernel/vmlinux.lds.S b/arch/s390/kernel/vmlinux.lds.S
index 661a487a3048..35a6b3e6cc50 100644
--- a/arch/s390/kernel/vmlinux.lds.S
+++ b/arch/s390/kernel/vmlinux.lds.S
@@ -264,6 +264,7 @@ SECTIONS
DISCARDS
/DISCARD/ : {
*(.eh_frame)
- *(.interp)
+ *(.interp .dynamic)
+ *(.dynstr .hash .gnu.hash)
}
}

--
2.43.0