Merge pull request #644 from jpoimboe/no-seg-fault

create-diff-object: print error message instead of seg faulting
This commit is contained in:
Jessica Yu 2016-12-20 11:55:27 -08:00 committed by GitHub
commit 5046cc9243
1 changed files with 5 additions and 1 deletions

View File

@ -2043,8 +2043,12 @@ void kpatch_create_dynamic_rela_sections(struct kpatch_elf *kelf,
ALLOC_LINK(dynrela, &relasec->relas);
if (sec->base->sym)
dynrela->sym = sec->base->sym;
else
else if (sec->base->secsym)
dynrela->sym = sec->base->secsym;
else
ERROR("can't create dynrela for section %s (symbol %s): no bundled section or section symbol",
sec->name, rela->sym->name);
dynrela->type = R_X86_64_64;
dynrela->addend = rela->offset;
dynrela->offset = index * sizeof(*dynrelas);