linux/tools/objtool
Kai Huang 518755a7ee x86/tdx: Fix __noreturn build warning around __tdx_hypercall_failed()
LKP reported below build warning:

  vmlinux.o: warning: objtool: __tdx_hypercall+0x128: __tdx_hypercall_failed() is missing a __noreturn annotation

The __tdx_hypercall_failed() function definition already has __noreturn
annotation, but it turns out the __noreturn must be annotated to the
function declaration.

PeterZ explains:

  "FWIW, the reason being that...

   The point of noreturn is that the caller should know to stop generating
   code. For that the declaration needs the attribute, because call sites
   typically do not have access to the function definition in C."

Add __noreturn annotation to the declaration of __tdx_hypercall_failed()
to fix.  It's not a bad idea to document the __noreturn nature at the
definition site either, so keep the annotation at the definition.

Note <asm/shared/tdx.h> is also included by TDX related assembly files.
Include <linux/compiler_attributes.h> only in case of !__ASSEMBLY__
otherwise compiling assembly file would trigger build error.

Also, following the objtool documentation, add __tdx_hypercall_failed()
to "tools/objtool/noreturns.h".

Fixes: c641cfb5c1 ("x86/tdx: Make TDX_HYPERCALL asm similar to TDX_MODULE_CALL")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Kai Huang <kai.huang@intel.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20230918041858.331234-1-kai.huang@intel.com
Closes: https://lore.kernel.org/oe-kbuild-all/202309140828.9RdmlH2Z-lkp@intel.com/
2023-09-18 09:11:39 +02:00
..
arch x86/cpu: Rename original retbleed methods 2023-08-16 21:47:53 +02:00
Documentation objtool: Move noreturn function list to separate file 2023-05-16 06:31:55 -07:00
include/objtool objtool/x86: Fix SRSO mess 2023-08-16 09:39:16 +02:00
.gitignore objtool: Install libsubcmd in build 2023-01-30 16:27:46 -08:00
Build objtool: Install libsubcmd in build 2023-01-30 16:27:46 -08:00
builtin-check.c objtool: Add verbose option for disassembling affected functions 2023-05-16 06:31:51 -07:00
check.c objtool/x86: Fixup frame-pointer vs rethunk 2023-08-17 00:44:35 +02:00
elf.c objtool: initialize all of struct elf 2023-07-10 09:52:28 +02:00
Makefile objtool: Fix HOSTCC flag usage 2023-02-01 09:15:18 -08:00
noreturns.h x86/tdx: Fix __noreturn build warning around __tdx_hypercall_failed() 2023-09-18 09:11:39 +02:00
objtool.c objtool: Remove instruction::list 2023-02-23 09:21:44 +01:00
orc_dump.c x86,objtool: Split UNWIND_HINT_EMPTY in two 2023-03-23 23:18:58 +01:00
orc_gen.c objtool: Add elf_create_section_pair() 2023-06-07 10:03:17 -07:00
special.c objtool: Get rid of reloc->addend 2023-06-07 10:03:23 -07:00
sync-check.sh objtool: Add objtool_types.h 2023-03-23 23:18:56 +01:00
weak.c objtool: Ditch subcommands 2022-04-22 12:32:01 +02:00