mirror of https://github.com/dynup/kpatch
compare __func__ references by value
Fixes the following error: kpatch_correlate_static_local_variables: 850: found another static local variable matching __func__.49968 in patched .rela__verbose
This commit is contained in:
parent
1bb9b81db1
commit
b4b0f76e4c
|
@ -319,10 +319,13 @@ void kpatch_create_rela_list(struct kpatch_elf *kelf, struct section *sec)
|
|||
rela->sym = find_symbol_by_index(&kelf->symbols, symndx);
|
||||
if (!rela->sym)
|
||||
ERROR("could not find rela entry symbol\n");
|
||||
if (rela->sym->sec && (rela->sym->sec->sh.sh_flags & SHF_STRINGS)) {
|
||||
if (rela->sym->sec &&
|
||||
((rela->sym->sec->sh.sh_flags & SHF_STRINGS) ||
|
||||
!strncmp(rela->sym->name, ".rodata.__func__.", 17))) {
|
||||
rela->string = rela->sym->sec->data->d_buf + rela->addend;
|
||||
if (!rela->string)
|
||||
ERROR("could not lookup rela string\n");
|
||||
ERROR("could not lookup rela string for %s+%d",
|
||||
rela->sym->name, rela->addend);
|
||||
}
|
||||
|
||||
if (skip)
|
||||
|
@ -823,6 +826,15 @@ void kpatch_correlate_static_local_variables(struct kpatch_elf *base,
|
|||
sym->name[prefixlen+1] > '9')
|
||||
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 (!strncmp(sym->name, "__func__", prefixlen))
|
||||
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