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:
Julien Thierry 2019-08-28 15:16:48 +01:00
parent bd4fae25f9
commit 878bac379f
1 changed files with 2 additions and 3 deletions

View File

@ -1310,14 +1310,14 @@ static void kpatch_replace_sections_syms(struct kpatch_elf *kelf)
list_for_each_entry(rela, &sec->relas, list) {
if (rela->sym->type != STT_SECTION)
if (rela->sym->type != STT_SECTION || !rela->sym->sec)
continue;
/*
* Replace references to bundled sections with their
* symbols.
*/
if (rela->sym->sec && rela->sym->sec->sym) {
if (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;
if (sym->type == STT_SECTION ||
!sym->sec ||
sym->sec != rela->sym->sec)
continue;