Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion kpatch-build/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
include ../Makefile.inc

CFLAGS += -I../kmod/core
CFLAGS += -I../kmod/core -Wall
LDFLAGS = -lelf

TARGETS = create-diff-object add-patches-section link-vmlinux-syms
Expand Down
5 changes: 2 additions & 3 deletions kpatch-build/add-patches-section.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ static void find_section_by_name(struct elf *elf, char *name, struct section *se
GElf_Shdr sh;
char *secname;

while (scn = elf_nextscn(elf->elf, scn)) {
while ((scn = elf_nextscn(elf->elf, scn))) {
if (!gelf_getshdr(scn, &sh))
ERROR("gelf_getshdr");

Expand Down Expand Up @@ -207,7 +207,6 @@ int main(int argc, char **argv)
struct symlist symlist, symlistv;
struct sym *cur, *vsym;
struct elf elf, elfv;
char name[255];
void *buf;
struct kpatch_patch *patches_data;
GElf_Rela *relas_data;
Expand Down Expand Up @@ -252,7 +251,7 @@ int main(int argc, char **argv)
cur->vm_addr = vsym->sym.st_value;
cur->vm_len = vsym->sym.st_size;
cur->action = PATCH;
printf("original function at address %016lx (length %d)\n",
printf("original function at address %016lx (length %zu)\n",
cur->vm_addr, cur->vm_len);
patches_nr++;
}
Expand Down
8 changes: 3 additions & 5 deletions kpatch-build/create-diff-object.c
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,6 @@ struct kpatch_elf *kpatch_elf_open(const char *name)
void kpatch_compare_correlated_nonrela_section(struct section *sec)
{
struct section *sec1 = sec, *sec2 = sec->twin;
enum status status;

/* Compare section headers (must match or fatal) */
if (sec1->sh.sh_type != sec2->sh.sh_type ||
Expand Down Expand Up @@ -666,8 +665,7 @@ void kpatch_correlate_elfs(struct kpatch_elf *kelf1, struct kpatch_elf *kelf2)
void kpatch_compare_correlated_elements(struct kpatch_elf *kelf)
{
struct section *sec;
struct rela *rela;
int i, j;
int i;

/* tables are already correlated at this point */
kpatch_compare_correlated_nonrela_sections(&kelf->sections);
Expand Down Expand Up @@ -715,7 +713,7 @@ void kpatch_dump_kelf(struct kpatch_elf *kelf)
printf(", base-> %s\n", sec->base->name);
printf("rela section expansion\n");
for_each_rela(j, rela, &sec->relas) {
printf("sym %d, offset %d, type %d, %s %s %d %s\n",
printf("sym %lu, offset %d, type %d, %s %s %d %s\n",
GELF_R_SYM(rela->rela.r_info),
rela->offset, rela->type,
rela->sym->name,
Expand Down Expand Up @@ -1158,7 +1156,7 @@ void kpatch_create_symtab(struct kpatch_elf *kelf)

void kpatch_write_output_elf(struct kpatch_elf *kelf, Elf *elf, char *outfile)
{
int fd, i, index = 0;
int fd, i;
struct section *sec;
Elf *elfout;
GElf_Ehdr eh, ehout;
Expand Down
13 changes: 2 additions & 11 deletions kpatch-build/link-vmlinux-syms.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ static void find_section_by_name(struct elf *elf, char *name, struct section *se
GElf_Shdr sh;
char *secname;

while (scn = elf_nextscn(elf->elf, scn)) {
while ((scn = elf_nextscn(elf->elf, scn))) {
if (!gelf_getshdr(scn, &sh))
ERROR("gelf_getshdr");

Expand Down Expand Up @@ -205,17 +205,9 @@ int main(int argc, char **argv)
struct sym *cur, *vsym;
struct elf elf, elfv;
char name[255];
void *buf;
struct kpatch_patch *patches_data;
GElf_Rela *relas_data;
int patches_nr = 0, i, patches_size, relas_size, len;
int patches_offset, relas_offset, patches_index, relas_index;
struct section symtab;
Elf_Scn *scn;
Elf_Data *data;
GElf_Shdr sh, *shp;
GElf_Ehdr eh;
GElf_Sym sym;

/* set elf version (required by libelf) */
if (elf_version(EV_CURRENT) == EV_NONE)
Expand Down Expand Up @@ -280,7 +272,7 @@ int main(int argc, char **argv)
cur->vm_addr = vsym->sym.st_value;
cur->vm_len = vsym->sym.st_size;
cur->action = LINK;
printf("original symbol at address %016lx (length %d)\n",
printf("original symbol at address %016lx (length %zu)\n",
cur->vm_addr, cur->vm_len);
}

Expand Down Expand Up @@ -360,7 +352,6 @@ int main(int argc, char **argv)
#endif
find_section_by_name(&elf, ".symtab", &symtab);
scn = symtab.scn;
shp = &symtab.sh;

data = elf_getdata(scn, NULL);
if (!data)
Expand Down