mirror of https://github.com/dynup/kpatch
create-diff-object: Simplify relocation processing
If the symbol associated with a relocation does not have a section set, nothing is done for that relocation. Skip iterating through all the symbols of the ELF file in such a case. Signed-off-by: Julien Thierry <jthierry@redhat.com>
This commit is contained in:
parent
bd4fae25f9
commit
878bac379f
|
@ -1310,14 +1310,14 @@ static void kpatch_replace_sections_syms(struct kpatch_elf *kelf)
|
||||||
|
|
||||||
list_for_each_entry(rela, &sec->relas, list) {
|
list_for_each_entry(rela, &sec->relas, list) {
|
||||||
|
|
||||||
if (rela->sym->type != STT_SECTION)
|
if (rela->sym->type != STT_SECTION || !rela->sym->sec)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Replace references to bundled sections with their
|
* Replace references to bundled sections with their
|
||||||
* symbols.
|
* symbols.
|
||||||
*/
|
*/
|
||||||
if (rela->sym->sec && rela->sym->sec->sym) {
|
if (rela->sym->sec->sym) {
|
||||||
rela->sym = rela->sym->sec->sym;
|
rela->sym = rela->sym->sec->sym;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1359,7 +1359,6 @@ static void kpatch_replace_sections_syms(struct kpatch_elf *kelf)
|
||||||
int start, end;
|
int start, end;
|
||||||
|
|
||||||
if (sym->type == STT_SECTION ||
|
if (sym->type == STT_SECTION ||
|
||||||
!sym->sec ||
|
|
||||||
sym->sec != rela->sym->sec)
|
sym->sec != rela->sym->sec)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue