From nobody Fri Oct 3 13:34:13 2025 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BADF626B098 for ; Mon, 1 Sep 2025 07:22:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=114.242.206.163 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756711329; cv=none; b=NLUpI5nNNanlne2BJCvYRBxbAU98Dje/oRdRtScTq0vUsM7ZsqGxSrCMwq6BJd220sV5dNTO5t+udw/4xfcyyntZqrTawD4qa263GEY08hlJs7egMMjkIIZfWWh4AESsmRJXj8mP3JLsGKBmHD+C85/zXqlR66/fzmhPMTz3Gs0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756711329; c=relaxed/simple; bh=l+regno238br9pkM5MRI92DAazYFlprlkaIhCIRJo3g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KYSsbl2NQD6nXRtqa2hmo8r/fGvr2cJFy7WjRoZxISwHLrq6fiBdvZ/i/2902x/IVLkcIzt5cY1Obib2z0yK36sIGD86meKgrZBCsczRkUqBirNhvVO+1484qPQTaby4e0IY4fay7hbnpXhBpxIZb323CeTBmdv/Ra3n6bz2QKo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn; spf=pass smtp.mailfrom=loongson.cn; arc=none smtp.client-ip=114.242.206.163 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=loongson.cn Received: from loongson.cn (unknown [113.200.148.30]) by gateway (Coremail) with SMTP id _____8DxvdKcSbVoEkUFAA--.10718S3; Mon, 01 Sep 2025 15:22:04 +0800 (CST) Received: from linux.localdomain (unknown [113.200.148.30]) by front1 (Coremail) with SMTP id qMiowJAxE+SVSbVoxHB2AA--.44622S5; Mon, 01 Sep 2025 15:22:03 +0800 (CST) From: Tiezhu Yang To: Huacai Chen , Josh Poimboeuf , Peter Zijlstra , Nathan Chancellor Cc: loongarch@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v1 3/3] LoongArch: Fix unreachable instruction warnings about entry functions Date: Mon, 1 Sep 2025 15:21:56 +0800 Message-ID: <20250901072156.31361-4-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20250901072156.31361-1-yangtiezhu@loongson.cn> References: <20250901072156.31361-1-yangtiezhu@loongson.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: qMiowJAxE+SVSbVoxHB2AA--.44622S5 X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBj93XoWxZF45KF1rKw4kAF45Aw4DKFX_yoW5Zr1xpa 13Cr4DXrZ5CrnFyw1UJayrurWYv3ZxWw43W3WDGryrA39Fq3ZFqr40vrnrXFyqga17Kay0 gF48tFyq9F4UA3cCm3ZEXasCq-sJn29KB7ZKAUJUUUUr529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUB2b4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r126r13M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Cr0_Gr1UM28EF7xvwVC2z280aVAFwI0_Cr1j6rxdM28EF7xvwVC2z280aVCY1x0267AK xVWxJr0_GcWln4kS14v26r1Y6r17M2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12 xvs2x26I8E6xACxx1l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1q 6rW5McIj6I8E87Iv67AKxVW8JVWxJwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64 vIr41lc7CjxVAaw2AFwI0_JF0_Jw1l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_ Jr0_Gr1l4IxYO2xFxVAFwI0_Jrv_JF1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8Gjc xK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0xvE2Ix0 cI8IcVAFwI0_Gr0_Xr1lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK8V AvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVW8JVWxJwCI42IY6I8E87Iv6xkF7I0E 14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjxU4ApnDUUUU Content-Type: text/plain; charset="utf-8" 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 :=3D 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 :=3D y" in arch/loongarch/kernel/Makefile. Link: https://lore.kernel.org/lkml/20250814083651.GR4067720@noisy.programmi= ng.kicks-ass.net/ Suggested-by: Peter Zijlstra Signed-off-by: Tiezhu Yang Acked-by: Peter Zijlstra (Intel) --- 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. # =20 -OBJECT_FILES_NON_STANDARD_head.o :=3D y - always-$(KBUILD_BUILTIN) :=3D vmlinux.lds =20 obj-y +=3D 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 =20 SYM_CODE_START(kernel_entry) # kernel entry point + UNWIND_HINT_UNDEFINED =20 /* Config direct window and set PG */ SETUP_DMWINS t0 @@ -109,8 +110,6 @@ SYM_CODE_START(kernel_entry) # kernel entry point #endif =20 bl start_kernel - ASM_BUG() - SYM_CODE_END(kernel_entry) =20 #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 =20 SETUP_DMWINS t0 JUMP_VIRT_ADDR t0, t1 @@ -142,8 +142,6 @@ SYM_CODE_START(smpboot_entry) ld.d tp, t0, CPU_BOOT_TINFO =20 bl start_secondary - ASM_BUG() - SYM_CODE_END(smpboot_entry) =20 #endif /* CONFIG_SMP */ --=20 2.42.0