diff --git a/fdpp/loader/elf.c b/fdpp/loader/elf.c index 2b857f6c..78420264 100644 --- a/fdpp/loader/elf.c +++ b/fdpp/loader/elf.c @@ -132,7 +132,7 @@ static void elf_dl(struct elfstate *state, uint16_t seg) } } -void *elf_open(const char *name) +void *fdelf_open(const char *name) { Elf *elf; Elf_Scn *scn = NULL; @@ -207,14 +207,14 @@ void *elf_open(const char *name) return NULL; } -void elf_reloc(void *arg, uint16_t seg) +void fdelf_reloc(void *arg, uint16_t seg) { struct elfstate *state = (struct elfstate *)arg; elf_dl(state, seg); } -void elf_close(void *arg) +void fdelf_close(void *arg) { struct elfstate *state = (struct elfstate *)arg; @@ -230,7 +230,7 @@ static int do_getsymoff(struct elfstate *state, const char *name) return (err ? -1 : sym.st_value); } -void *elf_getsym(void *arg, const char *name) +void *fdelf_getsym(void *arg, const char *name) { struct elfstate *state = (struct elfstate *)arg; int off = do_getsymoff(state, name); @@ -239,19 +239,19 @@ void *elf_getsym(void *arg, const char *name) return state->addr + state->load_offs + off; } -int elf_getsymoff(void *arg, const char *name) +int fdelf_getsymoff(void *arg, const char *name) { struct elfstate *state = (struct elfstate *)arg; return do_getsymoff(state, name); } -void *elf_getloadaddr(void *arg) +void *fdelf_getloadaddr(void *arg) { struct elfstate *state = (struct elfstate *)arg; return state->addr + state->load_offs; } -int elf_getloadoff(void *arg) +int fdelf_getloadoff(void *arg) { struct elfstate *state = (struct elfstate *)arg; return state->load_offs; diff --git a/fdpp/loader/elf_priv.h b/fdpp/loader/elf_priv.h index aa2af02c..65b102c1 100644 --- a/fdpp/loader/elf_priv.h +++ b/fdpp/loader/elf_priv.h @@ -1,9 +1,9 @@ #include -void *elf_open(const char *name); -void elf_reloc(void *arg, uint16_t seg); -void elf_close(void *arg); -void *elf_getsym(void *arg, const char *name); -int elf_getsymoff(void *arg, const char *name); -void *elf_getloadaddr(void *arg); -int elf_getloadoff(void *arg); +void *fdelf_open(const char *name); +void fdelf_reloc(void *arg, uint16_t seg); +void fdelf_close(void *arg); +void *fdelf_getsym(void *arg, const char *name); +int fdelf_getsymoff(void *arg, const char *name); +void *fdelf_getloadaddr(void *arg); +int fdelf_getloadoff(void *arg); diff --git a/fdpp/loader/loader.c b/fdpp/loader/loader.c index d348bd70..401207dd 100644 --- a/fdpp/loader/loader.c +++ b/fdpp/loader/loader.c @@ -55,31 +55,31 @@ void *FdppKernelLoad(const char *dname, int *len, struct fdpp_bss_list **bss, rc = asprintf(&kname, "%s/%s", dname, _S(KRNL_ELFNAME)); assert(rc != -1); - handle = elf_open(kname); + handle = fdelf_open(kname); if (!handle) { fprintf(stderr, "failed to open %s\n", kname); free(kname); return NULL; } free(kname); - start = elf_getsym(handle, "_start"); - s = elf_getsymoff(handle, "_start"); + start = fdelf_getsym(handle, "_start"); + s = fdelf_getsymoff(handle, "_start"); if (s == -1) goto err_close; *_start = s; - end = elf_getsym(handle, "__InitTextEnd"); + end = fdelf_getsym(handle, "__InitTextEnd"); if (!end) goto err_close; - bstart = elf_getsym(handle, "__bss_start"); + bstart = fdelf_getsym(handle, "__bss_start"); if (!bstart) goto err_close; - bend = elf_getsym(handle, "__bss_end"); + bend = fdelf_getsym(handle, "__bss_end"); if (!bend) goto err_close; - ibstart = elf_getsym(handle, "__ibss_start"); + ibstart = fdelf_getsym(handle, "__ibss_start"); if (!ibstart) goto err_close; - ibend = elf_getsym(handle, "__ibss_end"); + ibend = fdelf_getsym(handle, "__ibss_end"); if (!ibend) goto err_close; *len = (uintptr_t)end - (uintptr_t)start; @@ -107,7 +107,7 @@ void *FdppKernelLoad(const char *dname, int *len, struct fdpp_bss_list **bss, return h; err_close: - elf_close(handle); + fdelf_close(handle); return NULL; } @@ -118,9 +118,9 @@ const void *FdppKernelReloc(void *handle, uint16_t seg, uint16_t *r_seg, assert(!(h->load_off & 0xf)); seg -= h->load_off >> 4; - elf_reloc(h->elf, seg); + fdelf_reloc(h->elf, seg); - hook(seg, elf_getsymoff, h->elf); + hook(seg, fdelf_getsymoff, h->elf); *r_seg = seg; return h->start; @@ -130,6 +130,6 @@ void FdppKernelFree(void *handle) { struct krnl_hndl *h = (struct krnl_hndl *)handle; - elf_close(h->elf); + fdelf_close(h->elf); free(h); }