[PATCH 09/27] efi/loongarch: Mark loongarch efi_boot_kernel() non-standard for objtool

Josh Poimboeuf <[email protected]>
Newsgroups gmane.linux.kernel.rust,gmane.linux.kernel,gmane.linux.kbuild.devel
Message-ID <b7da3bfec527a7de6399b60c500a1fa1aea2175a.1787890035.git.jpoimboe@kernel.org>
efi_boot_kernel() ends with a tail call through a __noreturn function
pointer, so the compiler emits nothing after it.  Objtool can't tell that
in indirect call doesn't return, so it sees execution fall off the end
of the function:

  vmlinux.o: warning: objtool: __efistub_efi_boot_kernel() falls through to next function __efistub_efi_get_memory_map()

This is boot code for which objtool/ORC coverage doesn't matter, so tell
objtool to ignore it.

Signed-off-by: Josh Poimboeuf <[email protected]>
---
 drivers/firmware/efi/libstub/loongarch.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/firmware/efi/libstub/loongarch.c b/drivers/firmware/efi/libstub/loongarch.c
index 2b0c87dc99088..737de9afd6a40 100644
--- a/drivers/firmware/efi/libstub/loongarch.c
+++ b/drivers/firmware/efi/libstub/loongarch.c
@@ -5,6 +5,7 @@
  * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
  */
 
+#include <linux/objtool.h>
 #include <asm/efi.h>
 #include <asm/addrspace.h>
 #include "efistub.h"
@@ -103,3 +104,10 @@ 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);
 }
+
+/*
+ * Objtool has no way of knowing the real_kernel_entry() indirect call is
+ * noreturn. Just tell it to ignore this function: it's boot code anyway, so
+ * ORC coverage isn't needed.
+ */
+STACK_FRAME_NON_STANDARD(efi_boot_kernel);
-- 
2.55.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.