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
18 changes: 18 additions & 0 deletions kpatch-build/create-diff-object.c
Original file line number Diff line number Diff line change
Expand Up @@ -1813,6 +1813,9 @@ static void kpatch_create_patches_sections(struct kpatch_elf *kelf,
struct rela *rela;
struct lookup_result result;
struct kpatch_patch_func *funcs;
int vmlinux, export = 0;

vmlinux = !strcmp(objname, "vmlinux");

/* count patched functions */
nr = 0;
Expand Down Expand Up @@ -1851,6 +1854,9 @@ static void kpatch_create_patches_sections(struct kpatch_elf *kelf,
log_debug("lookup for %s @ 0x%016lx len %lu\n",
sym->name, result.value, result.size);

if (vmlinux && lookup_is_exported_symbol(table, sym->name))
export = 1;

/* add entry in text section */
funcs[index].old_addr = result.value;
funcs[index].old_size = result.size;
Expand Down Expand Up @@ -1891,6 +1897,18 @@ static void kpatch_create_patches_sections(struct kpatch_elf *kelf,
offsetof(struct kpatch_patch_func,objname);

index++;

if (export) {
int len = strlen(sym->name) + strlen(".export") + 1;
char *sym_export = malloc(len);
if (!sym_export)
ERROR("malloc error");
snprintf(sym_export, len, "%s%s", sym->name, ".export");
log_debug("rename changed vmlinux export function: %s to %s\n",
sym->name, sym_export);
sym->name = sym_export;
export = 0;
}
}
}

Expand Down