From 325bccd89dd8bb1683106fdbcd9d1ebe53061ef6 Mon Sep 17 00:00:00 2001 From: Josh Poimboeuf Date: Wed, 11 May 2022 16:33:55 -0700 Subject: [PATCH] create-diff-object: skip conversion for sections which never have symbols These sections don't have symbols. Don't even try to replace references to them with symbols. Signed-off-by: Josh Poimboeuf --- kpatch-build/create-diff-object.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c index cc57db9..2d96598 100644 --- a/kpatch-build/create-diff-object.c +++ b/kpatch-build/create-diff-object.c @@ -1490,6 +1490,17 @@ static void kpatch_replace_sections_syms(struct kpatch_elf *kelf) if (rela->sym->type != STT_SECTION || !rela->sym->sec) continue; + /* + * These sections don't have symbols associated with + * them: + */ + if (!strcmp(rela->sym->name, ".toc") || + !strcmp(rela->sym->name, ".fixup") || + !strcmp(rela->sym->name, ".altinstr_replacement") || + !strcmp(rela->sym->name, ".altinstr_aux") || + !strcmp(rela->sym->name, ".text..refcount")) + continue; + /* * Replace references to bundled sections with their * symbols.