#define PATCH_INSN_SIZE 5
struct xsplice_patch_func {
+ char *name;
unsigned long new_addr;
- unsigned long new_size;
unsigned long old_addr;
- unsigned long old_size;
- char *name;
- unsigned char undo[8];
+ uint32_t new_size;
+ uint32_t old_size;
+ unsigned char pad[32];
};
struct special_section {
ERROR("%s too small to patch", sym->name);
/* add entry in text section */
+ funcs[index].name = NULL;
if (resolve)
funcs[index].old_addr = result.value;
else
funcs[index].old_size = result.size;
funcs[index].new_addr = 0;
funcs[index].new_size = sym->sym.st_size;
- memset(funcs[index].undo, 0, sizeof funcs[index].undo);
+ memset(funcs[index].pad, 0, sizeof funcs[index].pad);
/*
* Add a relocation that will populate
rela->type = R_X86_64_64;
rela->addend = 0;
rela->offset = index * sizeof(*funcs);
+ rela->offset = index * sizeof(*funcs) +
+ offsetof(struct xsplice_patch_func, new_addr);
/*
* Add a relocation that will populate