Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions kpatch-build/create-klp-module.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,19 @@ static void create_klp_relasecs_and_syms(struct kpatch_elf *kelf, struct section
ALLOC_LINK(rela, &klp_relasec->relas);
rela->sym = sym;
rela->type = krelas[index].type;
if (!strcmp(dest->sec->name, ".toc"))
if (!strcmp(dest->sec->name, ".toc")) {
rela->offset = toc_offset;
else
} else {
rela->offset = krelas[index].offset + dest->sym.st_value;
/*
* With GCC 6+ every local function symbol has the value of 0x8.
* If the destination sym is local function, don't add the
* sym value to the offset.
*/
if (dest->sym.st_value &&
dest->type == STT_FUNC && dest->bind == STB_LOCAL)
rela->offset -= 8;
}

/*
* GCC 6+ adds 0x8 to the offset of every local function entry
Expand Down