diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c index b2d3173..c696356 100644 --- a/kpatch-build/create-diff-object.c +++ b/kpatch-build/create-diff-object.c @@ -1113,6 +1113,13 @@ static void kpatch_replace_sections_syms(struct kpatch_elf *kelf) */ if (rela->sym->sec && rela->sym->sec->sym) { rela->sym = rela->sym->sec->sym; + + /* + * ppc64le: a GCC 6+ bundled function is at + * offset 8 in its section. + */ + rela->addend -= rela->sym->sym.st_value; + continue; } diff --git a/kpatch-build/create-klp-module.c b/kpatch-build/create-klp-module.c index b61bae3..edcd3eb 100644 --- a/kpatch-build/create-klp-module.c +++ b/kpatch-build/create-klp-module.c @@ -238,25 +238,12 @@ static void create_klp_relasecs_and_syms(struct kpatch_elf *kelf, struct section /* Add the rela to the .klp.rela. section */ ALLOC_LINK(rela, &klp_relasec->relas); rela->sym = sym; + rela->addend = krelas[index].addend; rela->type = krelas[index].type; if (!strcmp(dest->sec->name, ".toc")) rela->offset = toc_offset; else rela->offset = krelas[index].offset + dest->sym.st_value; - - /* - * GCC 6+ adds 0x8 to the offset of every local function entry - * in the .toc section, for avoiding the setup of the toc when - * the function is called locally. But when the previously - * local function becomes global, we don't want to skip the - * .toc setup anymore. - */ - if (!strcmp(dest->sec->name, ".toc") && - rela->sym->type == STT_FUNC && rela->sym->bind == STB_LOCAL) { - rela->addend = 0; - } else { - rela->addend = krelas[index].addend; - } } }