Re: [RFC][PATCH 13/17] objtool/x86: Add arch_is_offset_insn()

From: Josh Poimboeuf
Date: Wed Aug 09 2023 - 10:34:23 EST


On Wed, Aug 09, 2023 at 09:12:31AM +0200, Peter Zijlstra wrote:
> Add a little wrappery to identify the magic symbols that are actually
> inside another instruction -- yay for variable length instruction
> encoding.
>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
> ---
> tools/objtool/arch/x86/decode.c | 6 ++++++
> tools/objtool/check.c | 13 ++++++++++---
> tools/objtool/include/objtool/arch.h | 1 +
> tools/objtool/include/objtool/elf.h | 1 +
> 4 files changed, 18 insertions(+), 3 deletions(-)
>
> --- a/tools/objtool/arch/x86/decode.c
> +++ b/tools/objtool/arch/x86/decode.c
> @@ -826,3 +826,9 @@ bool arch_is_rethunk(struct symbol *sym)
> {
> return !strcmp(sym->name, "__x86_return_thunk");
> }
> +
> +bool arch_is_offset_insn(struct symbol *sym)
> +{
> + return !strcmp(sym->name, "zen_return_thunk") ||
> + !strcmp(sym->name, "srso_safe_ret");
> +}

arch_is_embedded_in_insn()?

--
Josh