From 79fd538f51cac7db0514fec1690879369ea2f1bd Mon Sep 17 00:00:00 2001 From: Josh Poimboeuf Date: Mon, 19 Dec 2016 17:29:57 -0600 Subject: [PATCH] create-diff-object: print error message instead of seg faulting Related to issue #629, print a useful error message at the time of the original error condition instead of seg faulting later. --- kpatch-build/create-diff-object.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c index 975c9a8..aab9ebe 100644 --- a/kpatch-build/create-diff-object.c +++ b/kpatch-build/create-diff-object.c @@ -2042,8 +2042,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);