mirror of https://github.com/dynup/kpatch
small replace_sections_syms refactor
Move this code block to a more logical place, outside of the symbol loop.
This commit is contained in:
parent
731de44ecf
commit
bb35e37c47
|
@ -1101,6 +1101,18 @@ void kpatch_replace_sections_syms(struct kpatch_elf *kelf)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (rela->type == R_X86_64_PC32) {
|
||||
struct insn insn;
|
||||
rela_insn(sec, rela, &insn);
|
||||
add_off = (long)insn.next_byte -
|
||||
(long)sec->base->data->d_buf -
|
||||
rela->offset;
|
||||
} else if (rela->type == R_X86_64_64 ||
|
||||
rela->type == R_X86_64_32S)
|
||||
add_off = 0;
|
||||
else
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Attempt to replace references to unbundled sections
|
||||
* with their symbols.
|
||||
|
@ -1111,18 +1123,6 @@ void kpatch_replace_sections_syms(struct kpatch_elf *kelf)
|
|||
sym->sec != rela->sym->sec)
|
||||
continue;
|
||||
|
||||
if (rela->type == R_X86_64_PC32) {
|
||||
struct insn insn;
|
||||
rela_insn(sec, rela, &insn);
|
||||
add_off = (long)insn.next_byte -
|
||||
(long)sec->base->data->d_buf -
|
||||
rela->offset;
|
||||
} else if (rela->type == R_X86_64_64 ||
|
||||
rela->type == R_X86_64_32S)
|
||||
add_off = 0;
|
||||
else
|
||||
continue;
|
||||
|
||||
if (sym->sym.st_value != rela->addend + add_off)
|
||||
continue;
|
||||
|
||||
|
|
Loading…
Reference in New Issue