mirror of https://github.com/dynup/kpatch
create-diff-object: use toc_rela() in kpatch_line_macro_change_only()
For ppc64le, if a rela goes through the .toc, it requires an extra level of indirection. Use toc_rela() here to ensure it gets the rela we care about. This will be needed for the upcoming patch which checks for `__func__`. For non-ppc64le arches, and for ppc64le relas which don't go through the .toc, toc_rela() is a no-op which just returns the rela. So this is harmless for non-.toc cases. Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
This commit is contained in:
parent
81296117f4
commit
af672577b3
|
@ -672,7 +672,7 @@ static bool kpatch_line_macro_change_only(struct kpatch_elf *kelf,
|
||||||
{
|
{
|
||||||
unsigned long offset, insn1_len, insn2_len;
|
unsigned long offset, insn1_len, insn2_len;
|
||||||
void *data1, *data2, *insn1, *insn2;
|
void *data1, *data2, *insn1, *insn2;
|
||||||
struct rela *rela;
|
struct rela *r, *rela;
|
||||||
bool found, found_any = false;
|
bool found, found_any = false;
|
||||||
|
|
||||||
if (sec->status != CHANGED ||
|
if (sec->status != CHANGED ||
|
||||||
|
@ -720,12 +720,16 @@ static bool kpatch_line_macro_change_only(struct kpatch_elf *kelf,
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
found = false;
|
found = false;
|
||||||
list_for_each_entry(rela, &sec->rela->relas, list) {
|
list_for_each_entry(r, &sec->rela->relas, list) {
|
||||||
|
|
||||||
if (rela->offset < offset + insn1_len)
|
if (r->offset < offset + insn1_len)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (toc_rela(rela) && toc_rela(rela)->string)
|
rela = toc_rela(r);
|
||||||
|
if (!rela)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (rela->string)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!strncmp(rela->sym->name, "__warned.", 9) ||
|
if (!strncmp(rela->sym->name, "__warned.", 9) ||
|
||||||
|
|
Loading…
Reference in New Issue