From 5eb6e5f044841b3f55209ac6a8a5844bb6ee3cb2 Mon Sep 17 00:00:00 2001 From: Yin Fengwei Date: Mon, 4 Aug 2025 11:27:01 +0800 Subject: [PATCH] anolis: vmlinux.lds.h: fix the build warning when orc unwind is enabled ANBZ: #23264 With kernel option CONFIG_RANDOMIZE_BASE, CONFIG_UNWINDER_ORC enabled and CONFIG_LD_ORPHAN_WARN_LEVEL set to "warn", build kernel showed following warning: ld: warning: orphan section `.init.orc_unwind' from `arch/arm64/kernel/pi/kaslr_early.pi.o' being placed in section `.init.orc_unwind' ld: warning: orphan section `.init.orc_unwind_ip' from `arch/arm64/kernel/pi/kaslr_early.pi.o' being placed in section `.init.orc_unwind_ip' ld: warning: orphan section `.init.orc_unwind' from `arch/arm64/kernel/pi/lib-fdt.pi.o' being placed in section `.init.orc_unwind' ld: warning: orphan section `.init.orc_unwind_ip' from `arch/arm64/kernel/pi/lib-fdt.pi.o' being placed in section `.init.orc_unwind_ip' ld: warning: orphan section `.init.orc_unwind' from `arch/arm64/kernel/pi/lib-fdt_ro.pi.o' being placed in section `.init.orc_unwind' ld: warning: orphan section `.init.orc_unwind_ip' from `arch/arm64/kernel/pi/lib-fdt_ro.pi.o' being placed in section `.init.orc_unwind_ip' The reason is the makefile in arch/arm64/kernel/pi/ adds prefix ".init" for all the sections in *pi.o. While the default vmlinux.ld file only defines the sections orc_unwind and orc_unwind_ip but not for .init.orc*. This warning was introduced by commit: 52f25c2f48ac49a9a831e53853e586f5752d88c5 which cherry-picked: https://lore.kernel.org/lkml/20230202074036.507249-1-madvenka@linux.microsoft.com Fixed the issue by introduce the sections for .init.orc*. Signed-off-by: Yin Fengwei Acked-by: Huang Ying --- include/asm-generic/vmlinux.lds.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index c45078a445c8..a97da4bb4072 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -823,6 +823,14 @@ .orc_unwind : AT(ADDR(.orc_unwind) - LOAD_OFFSET) { \ BOUNDED_SECTION_BY(.orc_unwind, _orc_unwind) \ } \ + . = ALIGN(4); \ + .init.orc_unwind_ip : AT(ADDR(.init.orc_unwind_ip) - LOAD_OFFSET) { \ + BOUNDED_SECTION_BY(.init.orc_unwind_ip, _init_orc_unwind_ip) \ + } \ + . = ALIGN(2); \ + .init.orc_unwind : AT(ADDR(.init.orc_unwind) - LOAD_OFFSET) { \ + BOUNDED_SECTION_BY(.init.orc_unwind, _init_orc_unwind) \ + } \ text_size = _etext - _stext; \ . = ALIGN(4); \ .orc_lookup : AT(ADDR(.orc_lookup) - LOAD_OFFSET) { \ -- Gitee