mirror of https://github.com/dynup/kpatch
lookup: skip discarded symbols in local symbol comparison
A few symbols are discarded in the kernel linking phase, which means they won't be in the lookup table. Skip their comparison. This fixes a bunch of warnings seen when building a patch which triggers a tree-wide rebuild: create-diff-object: ERROR: aes_glue.o: find_local_syms: 112: find_local_syms for aes_glue.c: found_none create-diff-object: ERROR: aesni-intel_glue.o: find_local_syms: 112: find_local_syms for aesni-intel_glue.c: found_none create-diff-object: ERROR: init.o: find_local_syms: 112: find_local_syms for init.c: found_none create-diff-object: ERROR: iosf_mbi.o: find_local_syms: 112: find_local_syms for iosf_mbi.c: found_none create-diff-object: ERROR: setup.o: find_local_syms: 112: find_local_syms for setup.c: found_none ... After this patch, there's still one warning remaining: create-diff-object: ERROR: dynamic_debug.o: find_local_syms: 133: find_local_syms for dynamic_debug.c: found_none That one has a completely different cause, which I'll fix in another pull request (coming soon). Fixes: #676
This commit is contained in:
parent
51f1f51f87
commit
85def82275
|
@ -56,6 +56,7 @@ struct lookup_table {
|
|||
struct object_symbol *obj_syms;
|
||||
struct export_symbol *exp_syms;
|
||||
struct object_symbol *local_syms;
|
||||
int vmlinux;
|
||||
};
|
||||
|
||||
#define for_each_obj_symbol(ndx, iter, table) \
|
||||
|
@ -64,6 +65,18 @@ struct lookup_table {
|
|||
#define for_each_exp_symbol(ndx, iter, table) \
|
||||
for (ndx = 0, iter = table->exp_syms; ndx < table->exp_nr; ndx++, iter++)
|
||||
|
||||
static int discarded_sym(struct lookup_table *table,
|
||||
struct sym_compare_type *sym)
|
||||
{
|
||||
if (table->vmlinux && sym->name &&
|
||||
(!strncmp(sym->name, "__exitcall_", 11) ||
|
||||
!strncmp(sym->name, "__brk_reservation_fn_", 21) ||
|
||||
!strncmp(sym->name, "__func_stack_frame_non_standard_", 32)))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void find_local_syms(struct lookup_table *table, char *hint,
|
||||
struct sym_compare_type *child_locals)
|
||||
{
|
||||
|
@ -95,6 +108,14 @@ static void find_local_syms(struct lookup_table *table, char *hint,
|
|||
if (sym->bind != STB_LOCAL || (sym->type != STT_FUNC && sym->type != STT_OBJECT))
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Symbols which get discarded at link time are missing from
|
||||
* the lookup table, so skip them.
|
||||
*/
|
||||
while (discarded_sym(table, child_sym))
|
||||
child_sym++;
|
||||
|
||||
/* make sure the child symbol and parent symbol match */
|
||||
if (child_sym->name && child_sym->type == sym->type &&
|
||||
!strcmp(child_sym->name, sym->name))
|
||||
child_sym++;
|
||||
|
@ -262,6 +283,8 @@ struct lookup_table *lookup_open(char *obj_path, char *symvers_path,
|
|||
ERROR("malloc table");
|
||||
memset(table, 0, sizeof(*table));
|
||||
|
||||
table->vmlinux = !strcmp(basename(obj_path), "vmlinux");
|
||||
|
||||
obj_read(table, obj_path);
|
||||
symvers_read(table, symvers_path);
|
||||
|
||||
|
|
Loading…
Reference in New Issue