mirror of https://github.com/dynup/kpatch
make __func__ a special static local
The __func__ static local variable should be deemed "special", because it doesn't need to be correlated and should be included when needed by an include function. I don't have a test case for F20, but this fixes the following types of issues when doing a full-tree recompile on RHEL 7: ERROR: cifssmb.o: object size mismatch: __func__.49322 ERROR: btmrvl_main.o: kpatch_correlate_static_local_variables: 982: static local variable __func__.44657 not used ERROR: iwch_qp.o: .rodata.__func__.46024 section header details differ
This commit is contained in:
parent
6175658196
commit
03995e5223
|
@ -314,8 +314,7 @@ void kpatch_create_rela_list(struct kpatch_elf *kelf, struct section *sec)
|
|||
if (!rela->sym)
|
||||
ERROR("could not find rela entry symbol\n");
|
||||
if (rela->sym->sec &&
|
||||
((rela->sym->sec->sh.sh_flags & SHF_STRINGS) ||
|
||||
!strncmp(rela->sym->name, ".rodata.__func__.", 17))) {
|
||||
(rela->sym->sec->sh.sh_flags & SHF_STRINGS)) {
|
||||
rela->string = rela->sym->sec->data->d_buf + rela->addend;
|
||||
if (!rela->string)
|
||||
ERROR("could not lookup rela string for %s+%d",
|
||||
|
@ -537,12 +536,18 @@ char *special_static_prefix(struct symbol *sym)
|
|||
|
||||
if (!strncmp(sym->name, "descriptor.", 11))
|
||||
return "descriptor.";
|
||||
|
||||
if (!strncmp(sym->name, "__func__.", 9))
|
||||
return "__func__.";
|
||||
}
|
||||
|
||||
if (sym->type == STT_SECTION) {
|
||||
if (!strncmp(sym->name, ".bss.__key.", 11))
|
||||
return ".bss.__key.";
|
||||
|
||||
if (!strncmp(sym->name, ".rodata.__func__.", 17))
|
||||
return ".rodata.__func__.";
|
||||
|
||||
/* __verbose section contains the descriptor variables */
|
||||
if (!strcmp(sym->name, "__verbose"))
|
||||
return sym->name;
|
||||
|
@ -952,15 +957,6 @@ void kpatch_correlate_static_local_variables(struct kpatch_elf *base,
|
|||
if (!strchr(sym->name, '.'))
|
||||
continue;
|
||||
|
||||
/*
|
||||
* __func__'s are special gcc static variables which contain
|
||||
* the function name. There's no need to correlate them
|
||||
* because they're read-only and their comparison is done in
|
||||
* rela_equal() by comparing the literal strings.
|
||||
*/
|
||||
if (!kpatch_mangled_strcmp(sym->name, "__func__.1"))
|
||||
continue;
|
||||
|
||||
/* find the patched function which uses the static variable */
|
||||
sec = NULL;
|
||||
list_for_each_entry(tmpsec, &patched->sections, list) {
|
||||
|
|
Loading…
Reference in New Issue