Re: [PATCH] objtool: Teach get_alt_entry() about more relocation types
From: Josh Poimboeuf
Date: Thu Sep 30 2021 - 13:41:45 EST
On Thu, Sep 30, 2021 at 12:43:10PM +0200, Peter Zijlstra wrote:
>
> Occasionally objtool encounters symbol (as opposed to section)
> relocations in .altinstructions. Typically they are the alternatives
> written by elf_add_alternative() as encountered on a noinstr
> validation run on vmlinux after having already ran objtool on the
> individual .o files.
>
> Basically this is the counterpart of commit 44f6a7c0755d ("objtool:
> Fix seg fault with Clang non-section symbols"), because when these new
> assemblers (binutils now also does this) strip the section symbols,
> elf_add_reloc_to_insn() is forced to emit symbol based relocations.
>
> As such, teach get_alt_entry() about different relocation types.
>
> Fixes: 9bc0bb50727c ("objtool/x86: Rewrite retpoline thunk calls")
> Reported-by: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>
> Reported-by: Borislav Petkov <bp@xxxxxxxxx>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
> ---
> tools/objtool/special.c | 32 +++++++++++++++++++++++++-------
> 1 file changed, 25 insertions(+), 7 deletions(-)
>
> --- a/tools/objtool/special.c
> +++ b/tools/objtool/special.c
> @@ -58,6 +58,24 @@ void __weak arch_handle_alternative(unsi
> {
> }
>
> +static bool reloc2sec_off(struct reloc *reloc, struct section **sec, unsigned long *off)
Acked-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
Though I'd prefer U change it 2 a function name which doesn't look like
a Prince song title.
--
Josh