mirror of
https://github.com/dynup/kpatch
synced 2025-02-18 18:56:58 +00:00
add error for sym value != 0
For a local object or function symbol, we expect that the section offset, sym.st_value, be 0 because we used -ffunction-sections and -fdata-section during compile. If value != 0, it undermines assumptions we make and should return an error. Exceptions should be handled on a case by case basis, like __ksymtab_strings. Signed-off-by: Seth Jennings <sjenning@redhat.com>
This commit is contained in:
parent
582f2b27e0
commit
8b9de30581
@ -384,8 +384,10 @@ void kpatch_create_symbol_table(struct kpatch_elf *kelf)
|
||||
*/
|
||||
if ((sym->type == STT_FUNC ||
|
||||
sym->type == STT_OBJECT) &&
|
||||
sym->sym.st_value == 0 &&
|
||||
strcmp(sym->sec->name, "__ksymtab_strings")) {
|
||||
if (sym->sym.st_value != 0)
|
||||
ERROR("symbol %s at offset %lu within section %s, expected 0",
|
||||
sym->name, sym->sym.st_value, sym->sec->name);
|
||||
sym->sec->sym = sym;
|
||||
} else if (sym->type == STT_SECTION) {
|
||||
sym->sec->secsym = sym;
|
||||
|
Loading…
Reference in New Issue
Block a user