create-diff-object: include relas for non-bundled sections

With test/integration/data-read-mostly.patch, create-diff-object
includes the __verbose section but not the .rela__verbose section, which
is a bug, resulting in the following printk during the integration
tests:

  [13740.801920] dynamic debug error adding module: (null)

If a non-bundled section is included, its rela section should also be
included.  Also add support for converting those relas to dynrelas.
This commit is contained in:
Josh Poimboeuf 2014-06-04 11:39:42 -05:00
parent 76157dce4a
commit a16bd618a5

View File

@ -941,9 +941,7 @@ void kpatch_include_symbol(struct symbol *sym, int recurselevel)
sec = sym->sec;
sec->include = 1;
inc_printf("section %s is included\n", sec->name);
if (sec->secsym == sym)
goto out;
if (sec->secsym) {
if (sec->secsym && sec->secsym != sym) {
sec->secsym->include = 1;
inc_printf("section symbol %s is included\n", sec->secsym->name);
}
@ -1742,10 +1740,10 @@ void kpatch_create_dynamic_rela_sections(struct kpatch_elf *kelf,
/* add rela to fill in dest field */
ALLOC_LINK(dynrela, &relasec->relas);
if (!sec2->base->sym)
ERROR("expected bundled symbol for section %s for dynrela src %s",
sec2->base->name, rela->sym->name);
dynrela->sym = sec2->base->sym;
if (sec2->base->sym)
dynrela->sym = sec2->base->sym;
else
dynrela->sym = sec2->base->secsym;
dynrela->type = R_X86_64_64;
dynrela->addend = rela->offset;
dynrela->offset = index * sizeof(*dynrelas);