From: Peter Zijlstra <peterz@infradead.org>
To: Tiezhu Yang <yangtiezhu@loongson.cn>
Cc: Huacai Chen <chenhuacai@kernel.org>,
Josh Poimboeuf <jpoimboe@kernel.org>,
Nathan Chancellor <nathan@kernel.org>,
loongarch@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 3/3] LoongArch: Fix unreachable instruction warnings about entry functions
Date: Mon, 1 Sep 2025 10:20:17 +0200 [thread overview]
Message-ID: <20250901082017.GC4067720@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20250901072156.31361-4-yangtiezhu@loongson.cn>
On Mon, Sep 01, 2025 at 03:21:56PM +0800, Tiezhu Yang wrote:
> When compiling with LLVM and CONFIG_LTO_CLANG is set, there exist the
> following objtool warnings:
>
> vmlinux.o: warning: objtool: kernel_entry+0x0: unreachable instruction
> vmlinux.o: warning: objtool: smpboot_entry+0x0: unreachable instruction
>
> kernel_entry() and smpboot_entry() are in arch/loongarch/kernel/head.S,
> there is "OBJECT_FILES_NON_STANDARD_head.o := y" to skip objtool checking
> for head.o, but the STACK_FRAME_NON_STANDARD macro does not work for link
> time validation of vmlinux.o according to objtool documentation, just give
> a proper unwind hint to silence the warnings.
>
> By the way, ASM_BUG() can be removed due to unnecessary, otherwise there
> are following warnings:
>
> kernel_entry+0xf4: start_kernel() missing __noreturn
> in .c/.h or NORETURN() in noreturns.h
>
> smpboot_entry+0x68: start_secondary() missing __noreturn
> in .c/.h or NORETURN() in noreturns.h
>
> This is because the previous instructions of kernel_entry+0xf4 and
> smpboot_entry+0x68 are the 'bl' instructions, start_kernel() and
> start_secondary() are the respective call destination symbols which
> are noreturn functions, then the 'bl' instructions are already marked
> as dead end in annotate_call_site().
>
> For now, it is time to remove "OBJECT_FILES_NON_STANDARD_head.o := y"
> in arch/loongarch/kernel/Makefile.
>
> Link: https://lore.kernel.org/lkml/20250814083651.GR4067720@noisy.programming.kicks-ass.net/
> Suggested-by: Peter Zijlstra <peterz@infradead.org>
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Right, this looks good.
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> ---
> arch/loongarch/kernel/Makefile | 2 --
> arch/loongarch/kernel/head.S | 6 ++----
> 2 files changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/arch/loongarch/kernel/Makefile b/arch/loongarch/kernel/Makefile
> index 6f5a4574a911..4302c5b0a201 100644
> --- a/arch/loongarch/kernel/Makefile
> +++ b/arch/loongarch/kernel/Makefile
> @@ -3,8 +3,6 @@
> # Makefile for the Linux/LoongArch kernel.
> #
>
> -OBJECT_FILES_NON_STANDARD_head.o := y
> -
> always-$(KBUILD_BUILTIN) := vmlinux.lds
>
> obj-y += head.o cpu-probe.o cacheinfo.o env.o setup.o entry.o genex.o \
> diff --git a/arch/loongarch/kernel/head.S b/arch/loongarch/kernel/head.S
> index e3865e92a917..a11880f3a7e1 100644
> --- a/arch/loongarch/kernel/head.S
> +++ b/arch/loongarch/kernel/head.S
> @@ -42,6 +42,7 @@ SYM_DATA(kernel_fsize, .long _kernel_fsize);
> .align 12
>
> SYM_CODE_START(kernel_entry) # kernel entry point
> + UNWIND_HINT_UNDEFINED
>
> /* Config direct window and set PG */
> SETUP_DMWINS t0
> @@ -109,8 +110,6 @@ SYM_CODE_START(kernel_entry) # kernel entry point
> #endif
>
> bl start_kernel
> - ASM_BUG()
> -
> SYM_CODE_END(kernel_entry)
>
> #ifdef CONFIG_SMP
> @@ -120,6 +119,7 @@ SYM_CODE_END(kernel_entry)
> * function after setting up the stack and tp registers.
> */
> SYM_CODE_START(smpboot_entry)
> + UNWIND_HINT_UNDEFINED
>
> SETUP_DMWINS t0
> JUMP_VIRT_ADDR t0, t1
> @@ -142,8 +142,6 @@ SYM_CODE_START(smpboot_entry)
> ld.d tp, t0, CPU_BOOT_TINFO
>
> bl start_secondary
> - ASM_BUG()
> -
> SYM_CODE_END(smpboot_entry)
>
> #endif /* CONFIG_SMP */
> --
> 2.42.0
>
next prev parent reply other threads:[~2025-09-01 8:20 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-01 7:21 [PATCH v1 0/3] Fix objtool warnings if LTO is enabled for LoongArch (Part 2) Tiezhu Yang
2025-09-01 7:21 ` [PATCH v1 1/3] objtool/LoongArch: Fix fall through warning about efi_boot_kernel() Tiezhu Yang
2025-09-01 8:16 ` Peter Zijlstra
2025-09-01 8:31 ` Tiezhu Yang
2025-09-03 19:17 ` Josh Poimboeuf
2025-09-04 2:15 ` Tiezhu Yang
2025-09-04 2:17 ` Huacai Chen
2025-09-04 17:26 ` Josh Poimboeuf
2025-09-05 4:33 ` Huacai Chen
2025-09-05 9:53 ` Tiezhu Yang
2025-09-01 7:21 ` [PATCH v1 2/3] objtool/LoongArch: Fix unreachable instruction warnings about EFISTUB Tiezhu Yang
2025-09-01 8:19 ` Peter Zijlstra
2025-09-01 8:39 ` Tiezhu Yang
2025-09-03 19:19 ` Josh Poimboeuf
2025-09-04 2:18 ` Tiezhu Yang
2025-09-04 2:21 ` Huacai Chen
2025-09-04 3:50 ` Tiezhu Yang
2025-09-04 3:59 ` Huacai Chen
2025-09-04 17:39 ` Josh Poimboeuf
2025-09-04 21:46 ` Josh Poimboeuf
2025-09-05 4:36 ` Huacai Chen
2025-09-05 16:04 ` Josh Poimboeuf
2025-09-09 3:59 ` Tiezhu Yang
2025-09-09 4:10 ` Huacai Chen
2025-09-09 16:05 ` Josh Poimboeuf
2025-09-10 6:55 ` Huacai Chen
2025-09-11 3:23 ` Josh Poimboeuf
2025-09-11 8:28 ` Huacai Chen
2025-09-01 7:21 ` [PATCH v1 3/3] LoongArch: Fix unreachable instruction warnings about entry functions Tiezhu Yang
2025-09-01 8:20 ` Peter Zijlstra [this message]
2025-09-03 19:22 ` Josh Poimboeuf
2025-09-04 1:26 ` Jinyang He
2025-09-04 3:18 ` Tiezhu Yang
2025-09-04 17:16 ` Josh Poimboeuf
2025-09-02 15:43 ` [PATCH v1 0/3] Fix objtool warnings if LTO is enabled for LoongArch (Part 2) Huacai Chen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250901082017.GC4067720@noisy.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=chenhuacai@kernel.org \
--cc=jpoimboe@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=loongarch@lists.linux.dev \
--cc=nathan@kernel.org \
--cc=yangtiezhu@loongson.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®