create-diff-object: don't convert relocation destinations to symbols

When creating .kpatch.relocations, there's no reason to convert the
relocation destinations to symbols.  In fact, it's actively harmful
because it makes it harder for create-klp-module to deal with the GCC 6+
8-byte localentry gap.

This also fixes a regression which was introduced in 5888f316e6, which
broke ppc64le relocations.

Fixes #754.

Fixes: 5888f316e6 ("create-klp-module: support unbundled symbols")
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
This commit is contained in:
Josh Poimboeuf 2017-11-08 13:55:03 -06:00
parent c6c153431f
commit 57321ad7e6
2 changed files with 3 additions and 8 deletions

View File

@ -2520,12 +2520,10 @@ static void kpatch_create_intermediate_sections(struct kpatch_elf *kelf,
/* add rela to fill in krelas[index].dest field */
ALLOC_LINK(rela2, &krela_sec->rela->relas);
if (sec->base->sym)
rela2->sym = sec->base->sym;
else if (sec->base->secsym)
if (sec->base->secsym)
rela2->sym = sec->base->secsym;
else
ERROR("can't create dynrela for section %s (symbol %s): no bundled section or section symbol",
ERROR("can't create dynrela for section %s (symbol %s): no bundled or section symbol",
sec->name, rela->sym->name);
rela2->type = ABSOLUTE_RELA_TYPE;

View File

@ -205,13 +205,10 @@ static void create_klp_relasecs_and_syms(struct kpatch_elf *kelf, struct section
/* Add the klp rela to the .klp.rela. section */
ALLOC_LINK(rela, &klp_relasec->relas);
rela->offset = dest->sym.st_value + dest_off;
rela->type = krelas[index].type;
rela->sym = sym;
rela->addend = krelas[index].addend;
if (!strcmp(dest->sec->name, ".toc"))
rela->offset = dest_off;
else
rela->offset = dest_off + dest->sym.st_value;
}
}