[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tencent_65EFC9C0B6F4B36D24BFAFBEBEE912D71A05@qq.com>
Date: Wed, 04 Sep 2024 17:24:21 +0800
From: laokz <laokz@...mail.com>
To: Josh Poimboeuf <jpoimboe@...nel.org>, live-patching@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, x86@...nel.org, Miroslav Benes
<mbenes@...e.cz>, Petr Mladek <pmladek@...e.com>, Joe Lawrence
<joe.lawrence@...hat.com>, Jiri Kosina <jikos@...nel.org>, Peter Zijlstra
<peterz@...radead.org>, Marcos Paulo de Souza <mpdesouza@...e.com>, Song
Liu <song@...nel.org>
Subject: Re: [RFC 21/31] objtool: Fix x86 addend calcuation
On Mon, 2024-09-02 at 21:00 -0700, Josh Poimboeuf wrote:
> arch_dest_reloc_offset() hard-codes the addend adjustment to 4, which
> isn't always true. In fact it's dependent on the instruction itself.
>
> Signed-off-by: Josh Poimboeuf <jpoimboe@...nel.org>
> ---
> tools/objtool/arch/loongarch/decode.c | 4 ++--
> tools/objtool/arch/powerpc/decode.c | 4 ++--
> tools/objtool/arch/x86/decode.c | 15 +++++++++++++--
> tools/objtool/check.c | 13 ++++---------
> tools/objtool/include/objtool/arch.h | 2 +-
> 5 files changed, 22 insertions(+), 16 deletions(-)
>
> diff --git a/tools/objtool/arch/loongarch/decode.c
> b/tools/objtool/arch/loongarch/decode.c
> index ef09996c772e..b5d44d7bce4e 100644
> --- a/tools/objtool/arch/loongarch/decode.c
> +++ b/tools/objtool/arch/loongarch/decode.c
> @@ -20,9 +20,9 @@ unsigned long arch_jump_destination(struct
> instruction *insn)
> return insn->offset + (insn->immediate << 2);
> }
>
> -unsigned long arch_dest_reloc_offset(int addend)
> +s64 arch_insn_adjusted_addend(struct instruction *insn, struct reloc
> *reloc)
> {
> - return addend;
> + return reloc_addend(addend);
reloc_addend(reloc) ?
Powered by blists - more mailing lists