From: Tiezhu Yang <yangtiezhu@loongson.cn>
To: Ard Biesheuvel <ardb@kernel.org>, Huacai Chen <chenhuacai@kernel.org>
Cc: Josh Poimboeuf <jpoimboe@kernel.org>,
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: Re: [PATCH v2] efistub: Only link libstub to final vmlinux
Date: Mon, 13 Oct 2025 15:34:52 +0800 [thread overview]
Message-ID: <3695be6e-bc75-1ee4-1222-95aafa44abdb@loongson.cn> (raw)
In-Reply-To: <CAMj1kXGvSnCMRVCW7eAxgLRWMEV3QRj3Dqg3PmZchZJNpnLK9w@mail.gmail.com>
On 2025/10/11 下午11:58, Ard Biesheuvel wrote:
> On Sat, 11 Oct 2025 at 08:01, Huacai Chen <chenhuacai@kernel.org> wrote:...>> Hmmm, I want to know whether this problem is an objtool issue or an
>> efistub issue in essence. If it is an objtool issue, we should fix
>> objtool and don't touch efistub. If it is an efistub issue, then we
>> should modify efistub (but not specific to LoongArch, when RISC-V and
>> ARM64 add objtool they will meet the same issue).
>>
>
> It is an objtool issue in essence.
>
> The generated code looks like this
>
> 9000000001743080: ff b7 fe 57 bl -332 <__efistub_kernel_entry_address>
> 9000000001743084: 26 03 c0 28 ld.d $a2, $s2, 0
> 9000000001743088: 87 00 15 00 move $a3, $a0
> 900000000174308c: 04 04 80 03 ori $a0, $zero, 1
> 9000000001743090: c5 02 15 00 move $a1, $fp
> 9000000001743094: e1 00 00 4c jirl $ra, $a3, 0
>
> 9000000001743098 <__efistub_exit_boot_func>:
> 9000000001743098: 63 c0 ff 02 addi.d $sp, $sp, -16
>
> There is nothing wrong with this code, given that the indirect call is
> to a __noreturn function, and so the fact that it falls through into
> __efistub_exit_boot_func() is not a problem.
>
> Even though the compiler does nothing wrong here, it would be nice if
> it would emit some kind of UD or BRK instruction after such a call, if
> only to make the backtrace more reliable. But the code is fine, and
> objtool simply does not have the information it needs to determine
> that the indirect call is of a variety that never returns.
>
> So I don't mind fixing it in the code, but only for LoongArch, given
> that the problem does not exist on arm64 or RISC-V.
I assume this is the final conclusion, if there is no objection,
I will send patch according to Ard's suggestion and update the
commit message in the next week, the code looks like this:
-----8<-----
diff --git a/drivers/firmware/efi/libstub/loongarch.c
b/drivers/firmware/efi/libstub/loongarch.c
index 3782d0a187d1..e5991aa9f805 100644
--- a/drivers/firmware/efi/libstub/loongarch.c
+++ b/drivers/firmware/efi/libstub/loongarch.c
@@ -10,8 +10,8 @@
#include "efistub.h"
#include "loongarch-stub.h"
-typedef void __noreturn (*kernel_entry_t)(bool efi, unsigned long cmdline,
- unsigned long systab);
+typedef void (*kernel_entry_t)(bool efi, unsigned long cmdline,
+ unsigned long systab);
efi_status_t check_platform_features(void)
{
@@ -81,4 +81,7 @@ efi_status_t efi_boot_kernel(void *handle,
efi_loaded_image_t *image,
real_kernel_entry(true, (unsigned long)cmdline_ptr,
(unsigned long)efi_system_table);
+
+ /* We should never get here, only to fix the objtool warning */
+ return EFI_LOAD_ERROR;
}
-----8<-----
Thanks,
Tiezhu
next prev parent reply other threads:[~2025-10-13 7:35 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-28 8:55 [PATCH v2] efistub: Only link libstub to final vmlinux Tiezhu Yang
2025-09-28 13:41 ` Ard Biesheuvel
2025-09-28 13:52 ` Huacai Chen
2025-09-28 14:39 ` Ard Biesheuvel
2025-09-28 14:41 ` Ard Biesheuvel
2025-10-09 7:27 ` Tiezhu Yang
2025-10-10 16:25 ` Ard Biesheuvel
2025-10-11 1:13 ` Tiezhu Yang
2025-10-11 2:54 ` Huacai Chen
2025-10-11 3:40 ` Ard Biesheuvel
2025-10-11 7:29 ` Tiezhu Yang
2025-10-11 7:42 ` Huacai Chen
2025-10-11 8:13 ` Tiezhu Yang
2025-10-11 14:48 ` Ard Biesheuvel
2025-10-11 15:01 ` Huacai Chen
2025-10-11 15:58 ` Ard Biesheuvel
2025-10-13 7:34 ` Tiezhu Yang [this message]
2025-10-13 14:09 ` Huacai Chen
2025-10-13 14:36 ` Ard Biesheuvel
2025-10-14 16:47 ` Josh Poimboeuf
2025-10-16 14:52 ` Ard Biesheuvel
2025-10-16 15:49 ` Josh Poimboeuf
2025-10-17 11:00 ` Ard Biesheuvel
2025-10-17 16:22 ` Josh Poimboeuf
2025-10-17 16:26 ` Ard Biesheuvel
2025-10-17 17:05 ` Josh Poimboeuf
2025-10-20 1:24 ` Tiezhu Yang
2025-10-20 6:55 ` Huacai Chen
2025-10-23 6:55 ` Tiezhu Yang
2025-10-23 8:01 ` Huacai Chen
2025-10-23 8:06 ` Ard Biesheuvel
2025-10-26 11:20 ` Huacai Chen
2025-10-28 13:47 ` Ard Biesheuvel
2025-11-10 1:18 ` Tiezhu Yang
2025-11-10 7:00 ` Huacai Chen
2025-11-11 16:49 ` Ard Biesheuvel
2025-11-11 18:00 ` Josh Poimboeuf
2025-11-15 3:16 ` Huacai Chen
2025-11-17 11:33 ` Will Deacon
2025-11-21 2:09 ` Paul Walmsley
2025-11-21 14:36 ` Huacai Chen
2025-11-22 11:04 ` Tiezhu Yang
2025-11-23 2:29 ` Huacai Chen
2025-11-23 3:37 ` Tiezhu Yang
2025-11-25 1:49 ` Josh Poimboeuf
2025-11-28 10:11 ` Huacai Chen
2025-09-30 2:52 ` 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=3695be6e-bc75-1ee4-1222-95aafa44abdb@loongson.cn \
--to=yangtiezhu@loongson.cn \
--cc=ardb@kernel.org \
--cc=chenhuacai@kernel.org \
--cc=jpoimboe@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=loongarch@lists.linux.dev \
/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