create-diff-object: include __dyndbg section when referenced by jump table

If the only reference to the `__dyndbg` section is through a jump table
entry, the section doesn't get included and the jump table relocations
end up with a dangling reference to an UNDEF section symbol.

Make sure jump table referenced dynamic debug symbols get their sections
included.

Fixes #1253.

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
This commit is contained in:
Josh Poimboeuf 2022-03-24 09:12:55 -07:00
parent 75f220233b
commit 4ba6f1fbc9
1 changed files with 10 additions and 0 deletions

View File

@ -2341,6 +2341,16 @@ static bool should_keep_jump_label(struct lookup_table *lookup,
}
/* The static key lives in vmlinux or the patch module itself */
/*
* If the jump label key lives in the '__dyndbg' section, make sure
* the section gets included, because we don't use klp relocs for
* dynamic debug symbols. For an example of such a key, see
* DYNAMIC_DEBUG_BRANCH().
*/
if (dynamic_debug)
kpatch_include_symbol(key->sym);
return true;
}