From nobody Thu Oct 2 09:20:57 2025 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 554C82F1FD9; Fri, 19 Sep 2025 09:36:25 +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=1758274588; cv=none; b=FVhJpWbxpHV5aZWF0sTmIkLLOqLQc75thI4XZiE2c0ON41z3gueH8oQkKAyc4nr+IoYln4X9XlIlKFZZpGlJBQskOrLfL17WsJhDoi0oRkzj/WsctsC2TipX5LNyHFv0r2oWE0Gw34ibfC3EuKNand6/hMykp3WkunnFl2CrgwU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758274588; c=relaxed/simple; bh=WcG0omybLt/WfUJoDZrm8GNqdvyombjqKFY+koInuQ0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=c4ntdD8hOjoAhF6ahwJzrWxgCTxnvPIvuoSbYK4QNjK0SSRA2B+BoNIX0LV4ilpTIF4d9v/Sd36i5UE1h5Dv2l4j+GQuFL2eF+n5hTLuqEJ5KFPYO8otPc7IVoCKWx6nFEA4yKigECLKmi+ccQfySIZhxnJfNVcOqKesFsM/vJk= 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 _____8DxM9AVJM1ooS0MAA--.26589S3; Fri, 19 Sep 2025 17:36:21 +0800 (CST) Received: from linux.localdomain (unknown [113.200.148.30]) by front1 (Coremail) with SMTP id qMiowJDxbMEPJM1oMmufAA--.61162S3; Fri, 19 Sep 2025 17:36:17 +0800 (CST) From: Tiezhu Yang To: Josh Poimboeuf , Huacai Chen Cc: loongarch@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, linux-efi@vger.kernel.org, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 1/3] LoongArch: Only link libstub to final vmlinux Date: Fri, 19 Sep 2025 17:36:13 +0800 Message-ID: <20250919093615.30235-2-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20250919093615.30235-1-yangtiezhu@loongson.cn> References: <20250919093615.30235-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: qMiowJDxbMEPJM1oMmufAA--.61162S3 X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBj93XoWxZF4rCF15tF13ury3Ar4rtFc_yoW5Wryfpa 1vkw42vrWDXrWvq3s7JFW0qw15tFs5Jr42qFyDGFZ8AryDXrn2vrZxArsrXF9Fq34DAFWI qF1xtF1akFyUA3gCm3ZEXasCq-sJn29KB7ZKAUJUUUUr529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUBYb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r1Y6r17M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Cr0_Gr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v2 6rxl6s0DM2kKe7AKxVWUXVWUAwAS0I0E0xvYzxvE52x082IY62kv0487Mc804VCY07AIYI kI8VC2zVCFFI0UMc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUAVWU twAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7VAKI4 8JMxkF7I0En4kS14v26r126r1DMxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j 6r4UMxCIbckI1I0E14v26r1Y6r17MI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwV AFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUtVW8ZwCIc40Y0x0EwIxGrwCI42IY6xIIjxv2 0xvE14v26r1I6r4UMIIF0xvE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwCI42IY6xAIw20EY4 v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AK xVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7IU8HKZJUUUUU== Content-Type: text/plain; charset="utf-8" When compiling with LLVM and CONFIG_LTO_CLANG is set, there exists the following objtool warning: vmlinux.o: warning: objtool: __efistub_efi_boot_kernel() falls through to next function __efistub_exit_boot_func() This is because efi_boot_kernel() doesn't end with a return instruction or an unconditional jump, then objtool has determined that the function can fall through into the next function. At the beginning, try to do something to make efi_boot_kernel() ends with an unconditional jump instruction, but this modification seems not proper. Since the efistub functions are useless for stack unwinder, they can be ignored by objtool. After many discussions, no need to link libstub to the vmlinux.o, only link libstub to the final vmlinux. Link: https://lore.kernel.org/lkml/pq4h7jgndnt6p45lj4kgubxjd5gidfetugcuf5rc= xzxxanzetd@6rrlpjnjsmuy/ Suggested-by: Josh Poimboeuf Signed-off-by: Tiezhu Yang --- Makefile | 1 + arch/loongarch/Makefile | 5 ++++- scripts/link-vmlinux.sh | 5 ++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 9771619ac596..b8e7c63ae3d1 100644 --- a/Makefile +++ b/Makefile @@ -1201,6 +1201,7 @@ KBUILD_VMLINUX_OBJS :=3D built-in.a $(patsubst %/, %/= lib.a, $(filter %/, $(libs-y) KBUILD_VMLINUX_LIBS :=3D $(filter-out %/, $(libs-y)) =20 export KBUILD_VMLINUX_LIBS +export KBUILD_VMLINUX_LIBS_PRELINK export KBUILD_LDS :=3D arch/$(SRCARCH)/kernel/vmlinux.lds =20 ifdef CONFIG_TRIM_UNUSED_KSYMS diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile index a3a9759414f4..e9c61f76a045 100644 --- a/arch/loongarch/Makefile +++ b/arch/loongarch/Makefile @@ -164,7 +164,10 @@ CHECKFLAGS +=3D $(shell $(CC) $(KBUILD_CPPFLAGS) $(KBU= ILD_CFLAGS) -dM -E -x c /dev endif =20 libs-y +=3D arch/loongarch/lib/ -libs-$(CONFIG_EFI_STUB) +=3D $(objtree)/drivers/firmware/efi/libstub/lib.a + +ifdef CONFIG_EFI_STUB +KBUILD_VMLINUX_LIBS_PRELINK +=3D $(objtree)/drivers/firmware/efi/libstub/l= ib.a +endif =20 drivers-y +=3D arch/loongarch/crypto/ =20 diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh index 51367c2bfc21..b3cbff31d8a9 100755 --- a/scripts/link-vmlinux.sh +++ b/scripts/link-vmlinux.sh @@ -61,12 +61,11 @@ vmlinux_link() shift =20 if is_enabled CONFIG_LTO_CLANG || is_enabled CONFIG_X86_KERNEL_IBT; then - # Use vmlinux.o instead of performing the slow LTO link again. objs=3Dvmlinux.o - libs=3D + libs=3D"${KBUILD_VMLINUX_LIBS_PRELINK}" else objs=3Dvmlinux.a - libs=3D"${KBUILD_VMLINUX_LIBS}" + libs=3D"${KBUILD_VMLINUX_LIBS} ${KBUILD_VMLINUX_LIBS_PRELINK}" fi =20 if is_enabled CONFIG_GENERIC_BUILTIN_DTB; then --=20 2.42.0