[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220407120141.43801-12-chenzhongjin@huawei.com>
Date: Thu, 7 Apr 2022 20:01:39 +0800
From: Chen Zhongjin <chenzhongjin@...wei.com>
To: <linux-kernel@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>
CC: <jthierry@...hat.com>, <catalin.marinas@....com>,
<will@...nel.org>, <mark.rutland@....com>, <ardb@...nel.org>,
<masahiroy@...nel.org>, <jpoimboe@...hat.com>,
<peterz@...radead.org>, <ycote@...hat.com>
Subject: [RFC PATCH v3 11/13] objtool: arm64: Handle supported relocations in alternatives
From: Julien Thierry <jthierry@...hat.com>
Based on get_alt_insn() in arch/arm64/kernel/alternative.c, arm64
alternative code adapts offsets for static branches and adrp
instructions.
Signed-off-by: Julien Thierry <jthierry@...hat.com>
---
tools/objtool/arch/arm64/special.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/tools/objtool/arch/arm64/special.c b/tools/objtool/arch/arm64/special.c
index 45f283283091..a70b91e8bd7d 100644
--- a/tools/objtool/arch/arm64/special.c
+++ b/tools/objtool/arch/arm64/special.c
@@ -10,7 +10,11 @@ bool arch_support_alt_relocation(struct special_alt *special_alt,
struct instruction *insn,
struct reloc *reloc)
{
- return false;
+ u32 opcode = *(u32 *)(insn->sec->data->d_buf + insn->offset);
+
+ return aarch64_insn_is_branch_imm(opcode) ||
+ aarch64_insn_is_adrp(opcode) ||
+ !aarch64_insn_uses_literal(opcode);
}
--
2.17.1
Powered by blists - more mailing lists