[PATCH v4 04/14] LoongArch: Fix EFI linking with -fdata-sections

George Guo <[email protected]> Fri, 24 Jul 2026 19:41:17 +0800
Newsgroups org.kernel.vger.live-patching,dev.linux.lists.llvm,dev.linux.lists.loongarch,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
From: George Guo <[email protected]>

When building with -fdata-sections, the .init.bss section gets split
up into a bunch of .init.bss.<var> sections.  Make sure they get linked
into .init.bss.

Co-developed-by: Kexin Liu <[email protected]>
Signed-off-by: Kexin Liu <[email protected]>
Signed-off-by: George Guo <[email protected]>
---
 arch/loongarch/kernel/vmlinux.lds.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/loongarch/kernel/vmlinux.lds.S b/arch/loongarch/kernel/vmlinux.lds.S
index 840d944c2f73..570f936df34e 100644
--- a/arch/loongarch/kernel/vmlinux.lds.S
+++ b/arch/loongarch/kernel/vmlinux.lds.S
@@ -96,7 +96,7 @@ SECTIONS
 #endif
 
 	.init.bss : {
-		*(.init.bss)
+		*(.init.bss .init.bss.*)	/* from the EFI stub */
 	}
 	. = ALIGN(PECOFF_SEGMENT_ALIGN);
 	__initdata_end = .;
-- 
2.53.0