diff options
-rw-r--r-- | libexec/ld.so/alpha/rtld_machine.c | 10 | ||||
-rw-r--r-- | libexec/ld.so/amd64/rtld_machine.c | 10 | ||||
-rw-r--r-- | libexec/ld.so/arm/rtld_machine.c | 10 | ||||
-rw-r--r-- | libexec/ld.so/dl_prebind.c | 8 | ||||
-rw-r--r-- | libexec/ld.so/dlfcn.c | 24 | ||||
-rw-r--r-- | libexec/ld.so/hppa/archdep.h | 4 | ||||
-rw-r--r-- | libexec/ld.so/hppa/rtld_machine.c | 10 | ||||
-rw-r--r-- | libexec/ld.so/i386/rtld_machine.c | 10 | ||||
-rw-r--r-- | libexec/ld.so/ldconfig/dl_prebind.c | 8 | ||||
-rw-r--r-- | libexec/ld.so/ldconfig/prebind.c | 22 | ||||
-rw-r--r-- | libexec/ld.so/library.c | 4 | ||||
-rw-r--r-- | libexec/ld.so/mips64/rtld_machine.c | 6 | ||||
-rw-r--r-- | libexec/ld.so/powerpc/rtld_machine.c | 10 | ||||
-rw-r--r-- | libexec/ld.so/resolve.c | 36 | ||||
-rw-r--r-- | libexec/ld.so/resolve.h | 8 | ||||
-rw-r--r-- | libexec/ld.so/sh/rtld_machine.c | 10 | ||||
-rw-r--r-- | libexec/ld.so/sparc/rtld_machine.c | 6 | ||||
-rw-r--r-- | libexec/ld.so/sparc64/rtld_machine.c | 6 |
18 files changed, 101 insertions, 101 deletions
diff --git a/libexec/ld.so/alpha/rtld_machine.c b/libexec/ld.so/alpha/rtld_machine.c index 2e1c5ad8b54..202bf9f4bc9 100644 --- a/libexec/ld.so/alpha/rtld_machine.c +++ b/libexec/ld.so/alpha/rtld_machine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtld_machine.c,v 1.41 2008/02/24 15:47:47 drahn Exp $ */ +/* $OpenBSD: rtld_machine.c,v 1.42 2008/04/09 21:45:26 kurt Exp $ */ /* * Copyright (c) 1999 Dale Rahn @@ -53,7 +53,7 @@ _dl_md_reloc(elf_object_t *object, int rel, int relasz) Elf64_Rela *relas; struct load_list *llist; - loff = object->load_offs; + loff = object->obj_base; numrela = object->Dyn.info[relasz] / sizeof(Elf64_Rela); relas = (Elf64_Rela *)(object->Dyn.info[rel]); @@ -176,7 +176,7 @@ _dl_bind(elf_object_t *object, int reloff) rela = (Elf_RelA *)(object->Dyn.info[DT_JMPREL] + reloff); - addr = (Elf_Addr *)(object->load_offs + rela->r_offset); + addr = (Elf_Addr *)(object->obj_base + rela->r_offset); if (object->plt_size != 0 && !(*addr >= object->plt_start && *addr < (object->plt_start + object->plt_size ))) { /* something is broken, relocation has already occurred */ @@ -294,9 +294,9 @@ _dl_md_reloc_got(elf_object_t *object, int lazy) rela = (Elf_RelA *)(object->Dyn.info[DT_JMPREL]); for (i = 0; i < size; i++) { - addr = (Elf_Addr *)(object->load_offs + + addr = (Elf_Addr *)(object->obj_base + rela[i].r_offset); - *addr += object->load_offs; + *addr += object->obj_base; } } } diff --git a/libexec/ld.so/amd64/rtld_machine.c b/libexec/ld.so/amd64/rtld_machine.c index 0eed629fa60..dcf9669b983 100644 --- a/libexec/ld.so/amd64/rtld_machine.c +++ b/libexec/ld.so/amd64/rtld_machine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtld_machine.c,v 1.13 2007/11/27 16:42:19 miod Exp $ */ +/* $OpenBSD: rtld_machine.c,v 1.14 2008/04/09 21:45:26 kurt Exp $ */ /* * Copyright (c) 2002,2004 Dale Rahn @@ -178,7 +178,7 @@ _dl_md_reloc(elf_object_t *object, int rel, int relsz) Elf_RelA *rels; struct load_list *llist; - loff = object->load_offs; + loff = object->obj_base; numrel = object->Dyn.info[relsz] / sizeof(Elf_RelA); rels = (Elf_RelA *)(object->Dyn.info[rel]); if (rels == NULL) @@ -348,7 +348,7 @@ _dl_bind(elf_object_t *object, int index) sym += ELF_R_SYM(rel->r_info); symn = object->dyn.strtab + sym->st_name; - addr = (Elf_Word *)(object->load_offs + rel->r_offset); + addr = (Elf_Word *)(object->obj_base + rel->r_offset); this = NULL; ooff = _dl_find_symbol(symn, &this, SYM_SEARCH_ALL|SYM_WARNNOTFOUND|SYM_PLT, sym, @@ -431,8 +431,8 @@ _dl_md_reloc_got(elf_object_t *object, int lazy) num = (object->Dyn.info[DT_PLTRELSZ]); for (i = 0; i < num/sizeof(Elf_RelA); i++, rel++) { Elf_Addr *where; - where = (Elf_Addr *)(rel->r_offset + object->load_offs); - *where += object->load_offs; + where = (Elf_Addr *)(rel->r_offset + object->obj_base); + *where += object->obj_base; } } diff --git a/libexec/ld.so/arm/rtld_machine.c b/libexec/ld.so/arm/rtld_machine.c index 19efa9ea06e..c509275acae 100644 --- a/libexec/ld.so/arm/rtld_machine.c +++ b/libexec/ld.so/arm/rtld_machine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtld_machine.c,v 1.13 2008/02/24 15:47:47 drahn Exp $ */ +/* $OpenBSD: rtld_machine.c,v 1.14 2008/04/09 21:45:26 kurt Exp $ */ /* * Copyright (c) 2004 Dale Rahn @@ -166,7 +166,7 @@ _dl_md_reloc(elf_object_t *object, int rel, int relsz) Elf_Rel *rels; struct load_list *llist; - loff = object->load_offs; + loff = object->obj_base; numrel = object->Dyn.info[relsz] / sizeof(Elf_Rel); rels = (Elf_Rel *)(object->Dyn.info[rel]); @@ -365,8 +365,8 @@ _dl_md_reloc_got(elf_object_t *object, int lazy) for (i = 0; i < num/sizeof(Elf_Rel); i++, rel++) { Elf_Addr *where; - where = (Elf_Addr *)(rel->r_offset + object->load_offs); - *where += object->load_offs; + where = (Elf_Addr *)(rel->r_offset + object->obj_base); + *where += object->obj_base; } pltgot[1] = (Elf_Addr)object; @@ -407,7 +407,7 @@ _dl_bind(elf_object_t *object, int relidx) *((int *)0) = 0; /* XXX */ } - addr = (Elf_Addr *)(object->load_offs + rel->r_offset); + addr = (Elf_Addr *)(object->obj_base + rel->r_offset); newval = ooff + this->st_value; /* if GOT is protected, allow the write */ diff --git a/libexec/ld.so/dl_prebind.c b/libexec/ld.so/dl_prebind.c index d4c32c90cd8..8a83e28a0cf 100644 --- a/libexec/ld.so/dl_prebind.c +++ b/libexec/ld.so/dl_prebind.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dl_prebind.c,v 1.8 2006/05/12 22:14:04 drahn Exp $ */ +/* $OpenBSD: dl_prebind.c,v 1.9 2008/04/09 21:45:26 kurt Exp $ */ /* * Copyright (c) 2006 Dale Rahn <drahn@dalerahn.com> * @@ -261,7 +261,7 @@ prebind_symcache(elf_object_t *object, int plt) DL_DEB(("symidx %d: obj %d %s sym %d %s flags %d %x\n", s->idx, s->obj_idx, tobj->load_name, s->sym_idx, str, SYM_SEARCH_ALL|SYM_WARNNOTFOUND|plt, - object->load_addr + sym->st_value)); + object->obj_base + sym->st_value)); #endif _dl_symcache[s->idx].obj = tobj; _dl_symcache[s->idx].sym = sym; @@ -292,7 +292,7 @@ prebind_symcache(elf_object_t *object, int plt) DL_DEB(("symidx %d: obj %d %s sym %d %s flags %d %x\n", f->sym, f->obj_idx, tobj->load_name, f->sym_idx, str, SYM_SEARCH_ALL|SYM_WARNNOTFOUND|plt, - object->load_addr + sym->st_value)); + object->obj_base + sym->st_value)); #endif _dl_symcache[f->sym].obj = tobj; _dl_symcache[f->sym].sym = sym; @@ -328,7 +328,7 @@ prebind_symcache(elf_object_t *object, int plt) DL_DEB(("symidx %d: obj %d %s sym %d %s flags %d %x\n", f->sym, f->obj_idx, tobj->load_name, f->sym_idx, str, SYM_SEARCH_ALL|SYM_WARNNOTFOUND|plt, - object->load_addr + sym->st_value)); + object->obj_base + sym->st_value)); #endif _dl_symcache[f->sym].obj = tobj; _dl_symcache[f->sym].sym = sym; diff --git a/libexec/ld.so/dlfcn.c b/libexec/ld.so/dlfcn.c index 6f0ce83274c..f678924eebd 100644 --- a/libexec/ld.so/dlfcn.c +++ b/libexec/ld.so/dlfcn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dlfcn.c,v 1.77 2007/11/27 18:56:32 kurt Exp $ */ +/* $OpenBSD: dlfcn.c,v 1.78 2008/04/09 21:45:26 kurt Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -395,7 +395,7 @@ _dl_tracefmt(int fd, elf_object_t *object, const char *fmt1, const char *fmt2, break; case 'e': _dl_fdprintf(fd, "%lX", - (void *)(object->load_addr + + (void *)(object->load_base + object->load_size)); break; case 'g': @@ -423,7 +423,7 @@ _dl_tracefmt(int fd, elf_object_t *object, const char *fmt1, const char *fmt2, _dl_fdprintf(fd, "%s", objtypename); break; case 'x': - _dl_fdprintf(fd, "%lX", object->load_addr); + _dl_fdprintf(fd, "%lX", object->load_base); break; } } @@ -546,17 +546,17 @@ dl_iterate_phdr(int (*callback)(struct dl_phdr_info *, size_t, void *data), int retval = -1; for (object = _dl_objects; object != NULL; object = object->next) { - ehdr = (Elf_Ehdr *)object->load_addr; + ehdr = (Elf_Ehdr *)object->load_base; if (object->phdrp == NULL && ehdr == NULL) continue; - info.dlpi_addr = object->load_addr; + info.dlpi_addr = object->load_base; info.dlpi_name = object->load_name; info.dlpi_phdr = object->phdrp; info.dlpi_phnum = object->phdrc; if (info.dlpi_phdr == NULL) { info.dlpi_phdr = (Elf_Phdr *) - ((char *)object->load_addr + ehdr->e_phoff); + ((char *)object->load_base + ehdr->e_phoff); info.dlpi_phnum = ehdr->e_phnum; } retval = callback(&info, sizeof (struct dl_phdr_info), data); @@ -578,9 +578,9 @@ obj_from_addr(const void *addr) int i; for (dynobj = _dl_objects; dynobj != NULL; dynobj = dynobj->next) { - if (dynobj->load_addr != NULL) { - ehdr = (Elf_Ehdr *)dynobj->load_addr; - phdr = (Elf_Phdr *)((char *)dynobj->load_addr + ehdr->e_phoff); + if (dynobj->load_base != NULL) { + ehdr = (Elf_Ehdr *)dynobj->load_base; + phdr = (Elf_Phdr *)((char *)dynobj->load_base + ehdr->e_phoff); phdrc = ehdr->e_phnum; } else if (dynobj->phdrp != NULL) { phdr = dynobj->phdrp; @@ -591,7 +591,7 @@ obj_from_addr(const void *addr) for (i = 0; i < phdrc; i++) { switch (phdr[i].p_type) { case PT_LOAD: - start = phdr[i].p_vaddr + dynobj->load_addr; + start = dynobj->obj_base + phdr[i].p_vaddr; if ((Elf_Addr)addr >= start && (Elf_Addr)addr < start + phdr[i].p_memsz) return dynobj; @@ -621,7 +621,7 @@ dladdr(const void *addr, Dl_info *info) } info->dli_fname = (char *)object->load_name; - info->dli_fbase = (void *)object->load_addr; + info->dli_fbase = (void *)object->load_base; info->dli_sname = NULL; info->dli_saddr = (void *)0; @@ -644,7 +644,7 @@ dladdr(const void *addr, Dl_info *info) * it is further away from addr than the current nearest * symbol, then reject it. */ - symbol_addr = (void *)(object->load_addr + sym->st_value); + symbol_addr = (void *)(object->obj_base + sym->st_value); if (symbol_addr > addr || symbol_addr < info->dli_saddr) continue; diff --git a/libexec/ld.so/hppa/archdep.h b/libexec/ld.so/hppa/archdep.h index 94e56079b42..83ce7ec38fc 100644 --- a/libexec/ld.so/hppa/archdep.h +++ b/libexec/ld.so/hppa/archdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: archdep.h,v 1.3 2005/09/16 23:19:42 drahn Exp $ */ +/* $OpenBSD: archdep.h,v 1.4 2008/04/09 21:45:26 kurt Exp $ */ /* * Copyright (c) 2004 Michael Shalayeff @@ -95,7 +95,7 @@ RELOC_RELA(Elf_RelA *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v) hppa_call((arg), (sobj)->dyn.pltgot, (func)) #define MD_ATEXIT(sobj, sym, func) \ - MD_CALL((sobj), (void (*)())((sobj)->load_offs + (sym)->st_value), &_hppa_dl_dtors) + MD_CALL((sobj), (void (*)())((sobj)->obj_base + (sym)->st_value), &_hppa_dl_dtors) #define GOT_PERMS PROT_READ diff --git a/libexec/ld.so/hppa/rtld_machine.c b/libexec/ld.so/hppa/rtld_machine.c index 47f2e7bab03..3398eb5ec82 100644 --- a/libexec/ld.so/hppa/rtld_machine.c +++ b/libexec/ld.so/hppa/rtld_machine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtld_machine.c,v 1.14 2007/11/27 16:42:19 miod Exp $ */ +/* $OpenBSD: rtld_machine.c,v 1.15 2008/04/09 21:45:26 kurt Exp $ */ /* * Copyright (c) 2004 Michael Shalayeff @@ -101,7 +101,7 @@ _dl_md_reloc(elf_object_t *object, int rel, int relasz) int i, numrela, fails = 0; size_t size; - loff = object->load_offs; + loff = object->obj_base; numrela = object->Dyn.info[relasz] / sizeof(Elf_RelA); rela = (Elf_RelA *)(object->Dyn.info[rel]); @@ -217,7 +217,7 @@ _dl_md_reloc(elf_object_t *object, int rel, int relasz) DL_DEB(("[%x]PLABEL32: bad\n", i)); break; } - *pt = _dl_md_plabel(sobj->load_offs + + *pt = _dl_md_plabel(sobj->obj_base + this->st_value + rela->r_addend, sobj->dyn.pltgot); #ifdef DEBUG @@ -325,7 +325,7 @@ _dl_md_reloc_got(elf_object_t *object, int lazy) } else { rela = (Elf_RelA *)(object->dyn.jmprel); numrela = object->dyn.pltrelsz / sizeof(Elf_RelA); - ooff = object->load_offs; + ooff = object->obj_base; for (i = 0; i < numrela; i++, rela++) { Elf_Addr *r_addr = (Elf_Addr *)(ooff + rela->r_offset); @@ -367,7 +367,7 @@ _dl_bind(elf_object_t *object, int reloff) sym += ELF_R_SYM(rela->r_info); symn = object->dyn.strtab + sym->st_name; - addr = (Elf_Addr *)(object->load_offs + rela->r_offset); + addr = (Elf_Addr *)(object->obj_base + rela->r_offset); this = NULL; ooff = _dl_find_symbol(symn, &this, SYM_SEARCH_ALL|SYM_WARNNOTFOUND|SYM_PLT, sym, object, &sobj); diff --git a/libexec/ld.so/i386/rtld_machine.c b/libexec/ld.so/i386/rtld_machine.c index 34b0588b751..c43666e0fda 100644 --- a/libexec/ld.so/i386/rtld_machine.c +++ b/libexec/ld.so/i386/rtld_machine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtld_machine.c,v 1.22 2007/11/27 16:42:19 miod Exp $ */ +/* $OpenBSD: rtld_machine.c,v 1.23 2008/04/09 21:45:26 kurt Exp $ */ /* * Copyright (c) 2002 Dale Rahn @@ -176,7 +176,7 @@ _dl_md_reloc(elf_object_t *object, int rel, int relsz) Elf_Rel *rels; struct load_list *llist; - loff = object->load_offs; + loff = object->obj_base; numrel = object->Dyn.info[relsz] / sizeof(Elf32_Rel); rels = (Elf32_Rel *)(object->Dyn.info[rel]); if (rels == NULL) @@ -352,7 +352,7 @@ _dl_bind(elf_object_t *object, int index) sym += ELF_R_SYM(rel->r_info); symn = object->dyn.strtab + sym->st_name; - addr = (Elf_Word *)(object->load_offs + rel->r_offset); + addr = (Elf_Word *)(object->obj_base + rel->r_offset); this = NULL; ooff = _dl_find_symbol(symn, &this, SYM_SEARCH_ALL|SYM_WARNNOTFOUND|SYM_PLT, sym, object, NULL); @@ -439,8 +439,8 @@ _dl_md_reloc_got(elf_object_t *object, int lazy) } for (i = 0; i < num/sizeof(Elf_Rel); i++, rel++) { Elf_Addr *where; - where = (Elf_Addr *)(rel->r_offset + object->load_offs); - *where += object->load_offs; + where = (Elf_Addr *)(rel->r_offset + object->obj_base); + *where += object->obj_base; } for (llist = object->load_list; llist != NULL; llist = llist->next) { diff --git a/libexec/ld.so/ldconfig/dl_prebind.c b/libexec/ld.so/ldconfig/dl_prebind.c index e71052bb4ae..9e50a68db97 100644 --- a/libexec/ld.so/ldconfig/dl_prebind.c +++ b/libexec/ld.so/ldconfig/dl_prebind.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dl_prebind.c,v 1.1 2006/05/12 23:20:52 deraadt Exp $ */ +/* $OpenBSD: dl_prebind.c,v 1.2 2008/04/09 21:45:26 kurt Exp $ */ /* * Copyright (c) 2006 Dale Rahn <drahn@dalerahn.com> @@ -262,7 +262,7 @@ prebind_symcache(elf_object_t *object, int plt) DL_DEB(("symidx %d: obj %d %s sym %d %s flags %d %x\n", s->idx, s->obj_idx, tobj->load_name, s->sym_idx, str, SYM_SEARCH_ALL|SYM_WARNNOTFOUND|plt, - object->load_addr + sym->st_value)); + object->obj_base + sym->st_value)); #endif _dl_symcache[s->idx].obj = tobj; _dl_symcache[s->idx].sym = sym; @@ -293,7 +293,7 @@ prebind_symcache(elf_object_t *object, int plt) DL_DEB(("symidx %d: obj %d %s sym %d %s flags %d %x\n", f->sym, f->obj_idx, tobj->load_name, f->sym_idx, str, SYM_SEARCH_ALL|SYM_WARNNOTFOUND|plt, - object->load_addr + sym->st_value)); + object->obj_base + sym->st_value)); #endif _dl_symcache[f->sym].obj = tobj; _dl_symcache[f->sym].sym = sym; @@ -329,7 +329,7 @@ prebind_symcache(elf_object_t *object, int plt) DL_DEB(("symidx %d: obj %d %s sym %d %s flags %d %x\n", f->sym, f->obj_idx, tobj->load_name, f->sym_idx, str, SYM_SEARCH_ALL|SYM_WARNNOTFOUND|plt, - object->load_addr + sym->st_value)); + object->obj_base + sym->st_value)); #endif _dl_symcache[f->sym].obj = tobj; _dl_symcache[f->sym].sym = sym; diff --git a/libexec/ld.so/ldconfig/prebind.c b/libexec/ld.so/ldconfig/prebind.c index 2fdfc09dce0..3debfc7a1c7 100644 --- a/libexec/ld.so/ldconfig/prebind.c +++ b/libexec/ld.so/ldconfig/prebind.c @@ -1,4 +1,4 @@ -/* $OpenBSD: prebind.c,v 1.9 2007/09/02 15:19:20 deraadt Exp $ */ +/* $OpenBSD: prebind.c,v 1.10 2008/04/09 21:45:26 kurt Exp $ */ /* * Copyright (c) 2006 Dale Rahn <drahn@dalerahn.com> * @@ -497,7 +497,7 @@ elf_load_object(void *pexe, const char *name) Elf_Phdr *phdr; const Elf_Sym *symt; const char *strt; - Elf_Addr loff; + Elf_Addr lbase; Elf_Word *needed_list; int needed_cnt = 0, i; @@ -507,9 +507,9 @@ elf_load_object(void *pexe, const char *name) exit(10); } ehdr = pexe; - loff = (Elf_Addr)pexe; + lbase = (Elf_Addr)pexe; - object->load_addr = 0; + object->load_base = lbase; object->load_name = strdup(name); phdr = (Elf_Phdr *)((char *)pexe + ehdr->e_phoff); @@ -533,7 +533,7 @@ elf_load_object(void *pexe, const char *name) return NULL; /* not a dynamic binary */ } - dynp = (Elf_Dyn *)((unsigned long)dynp + loff); + dynp = (Elf_Dyn *)((unsigned long)dynp + lbase); odynp = dynp; while (dynp->d_tag != DT_NULL) { if (dynp->d_tag < DT_NUM) @@ -568,20 +568,20 @@ elf_load_object(void *pexe, const char *name) } if (object->Dyn.info[DT_HASH]) - map_to_virt(phdr, ehdr, loff, &object->Dyn.info[DT_HASH]); + map_to_virt(phdr, ehdr, lbase, &object->Dyn.info[DT_HASH]); if (object->Dyn.info[DT_STRTAB]) - map_to_virt(phdr, ehdr, loff, &object->Dyn.info[DT_STRTAB]); + map_to_virt(phdr, ehdr, lbase, &object->Dyn.info[DT_STRTAB]); if (object->Dyn.info[DT_SYMTAB]) - map_to_virt(phdr, ehdr, loff, &object->Dyn.info[DT_SYMTAB]); + map_to_virt(phdr, ehdr, lbase, &object->Dyn.info[DT_SYMTAB]); if (object->Dyn.info[DT_RELA]) - map_to_virt(phdr, ehdr, loff, &object->Dyn.info[DT_RELA]); + map_to_virt(phdr, ehdr, lbase, &object->Dyn.info[DT_RELA]); if (object->Dyn.info[DT_RPATH]) object->Dyn.info[DT_RPATH] += object->Dyn.info[DT_STRTAB]; if (object->Dyn.info[DT_REL]) - map_to_virt(phdr, ehdr, loff, &object->Dyn.info[DT_REL]); + map_to_virt(phdr, ehdr, lbase, &object->Dyn.info[DT_REL]); if (object->Dyn.info[DT_JMPREL]) - map_to_virt(phdr, ehdr, loff, &object->Dyn.info[DT_JMPREL]); + map_to_virt(phdr, ehdr, lbase, &object->Dyn.info[DT_JMPREL]); symt = object->dyn.symtab; strt = object->dyn.strtab; diff --git a/libexec/ld.so/library.c b/libexec/ld.so/library.c index d860a003c0e..b1cdb29bd21 100644 --- a/libexec/ld.so/library.c +++ b/libexec/ld.so/library.c @@ -1,4 +1,4 @@ -/* $OpenBSD: library.c,v 1.55 2008/04/02 02:27:36 drahn Exp $ */ +/* $OpenBSD: library.c,v 1.56 2008/04/09 21:45:26 kurt Exp $ */ /* * Copyright (c) 2002 Dale Rahn @@ -69,7 +69,7 @@ _dl_unload_shlib(elf_object_t *object) _dl_unload_shlib(n->data); DL_DEB(("unload_shlib unloading on %s\n", object->load_name)); _dl_load_list_free(object->load_list); - _dl_munmap((void *)object->load_addr, object->load_size); + _dl_munmap((void *)object->load_base, object->load_size); _dl_remove_object(object); } } diff --git a/libexec/ld.so/mips64/rtld_machine.c b/libexec/ld.so/mips64/rtld_machine.c index 20b27ab750d..024a3270c4d 100644 --- a/libexec/ld.so/mips64/rtld_machine.c +++ b/libexec/ld.so/mips64/rtld_machine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtld_machine.c,v 1.10 2007/11/27 16:42:19 miod Exp $ */ +/* $OpenBSD: rtld_machine.c,v 1.11 2008/04/09 21:45:26 kurt Exp $ */ /* * Copyright (c) 1998-2004 Opsycon AB, Sweden. @@ -49,7 +49,7 @@ _dl_md_reloc(elf_object_t *object, int rel, int relsz) Elf64_Rel *relocs; const Elf64_Sym *sym, *this; - loff = object->load_offs; + loff = object->obj_base; numrel = object->Dyn.info[relsz] / sizeof(Elf64_Rel); relocs = (Elf64_Rel *)(object->Dyn.info[rel]); @@ -183,7 +183,7 @@ _dl_md_reloc_got(elf_object_t *object, int lazy) return (0); lazy = 0; /* XXX Fix ld before enabling lazy */ - loff = object->load_offs; + loff = object->obj_base; strt = object->dyn.strtab; gotp = object->dyn.pltgot; n = object->Dyn.info[DT_MIPS_LOCAL_GOTNO - DT_LOPROC + DT_NUM]; diff --git a/libexec/ld.so/powerpc/rtld_machine.c b/libexec/ld.so/powerpc/rtld_machine.c index 32022413745..52df2ebc286 100644 --- a/libexec/ld.so/powerpc/rtld_machine.c +++ b/libexec/ld.so/powerpc/rtld_machine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtld_machine.c,v 1.44 2007/11/27 16:42:19 miod Exp $ */ +/* $OpenBSD: rtld_machine.c,v 1.45 2008/04/09 21:45:26 kurt Exp $ */ /* * Copyright (c) 1999 Dale Rahn @@ -89,7 +89,7 @@ _dl_md_reloc(elf_object_t *object, int rel, int relasz) Elf32_Addr *first_rela; - loff = object->load_offs; + loff = object->obj_base; numrela = object->Dyn.info[relasz] / sizeof(Elf32_Rela); relas = (Elf32_Rela *)(object->Dyn.info[rel]); @@ -497,12 +497,12 @@ _dl_md_reloc_got(elf_object_t *object, int lazy) } else { first_rela = (Elf32_Addr *) (((Elf32_Rela *)(object->Dyn.info[DT_JMPREL]))->r_offset + - object->load_offs); + object->obj_base); pltresolve = (Elf32_Addr *)(first_rela) - 18; relas = (Elf32_Rela *)(object->Dyn.info[DT_JMPREL]); numrela = object->Dyn.info[DT_PLTRELSZ] / sizeof(Elf32_Rela); - r_addr = (Elf32_Addr *)(relas->r_offset + object->load_offs); + r_addr = (Elf32_Addr *)(relas->r_offset + object->obj_base); for (i = 0, index = 0; i < numrela; i++, r_addr+=2, index++) { if (index >= (2 << 12)) { @@ -556,7 +556,7 @@ _dl_bind(elf_object_t *object, int reloff) sym += ELF_R_SYM(relas->r_info); symn = object->dyn.strtab + sym->st_name; - r_addr = (Elf_Addr *)(object->load_offs + relas->r_offset); + r_addr = (Elf_Addr *)(object->obj_base + relas->r_offset); this = NULL; ooff = _dl_find_symbol(symn, &this, SYM_SEARCH_ALL|SYM_WARNNOTFOUND|SYM_PLT, sym, diff --git a/libexec/ld.so/resolve.c b/libexec/ld.so/resolve.c index bef723cc59a..eaea1f42b4a 100644 --- a/libexec/ld.so/resolve.c +++ b/libexec/ld.so/resolve.c @@ -1,4 +1,4 @@ -/* $OpenBSD: resolve.c,v 1.47 2006/05/03 16:10:51 drahn Exp $ */ +/* $OpenBSD: resolve.c,v 1.48 2008/04/09 21:45:26 kurt Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -71,12 +71,12 @@ _dl_add_object(elf_object_t *object) */ elf_object_t * _dl_finalize_object(const char *objname, Elf_Dyn *dynp, const long *dl_data, - const int objtype, const long laddr, const long loff) + const int objtype, const long lbase, const long obase) { elf_object_t *object; #if 0 - _dl_printf("objname [%s], dynp %p, dl_data %p, objtype %x laddr %lx, loff %lx\n", - objname, dynp, dl_data, objtype, laddr, loff); + _dl_printf("objname [%s], dynp %p, dl_data %p, objtype %x lbase %lx, obase %lx\n", + objname, dynp, dl_data, objtype, lbase, obase); #endif object = _dl_malloc(sizeof(elf_object_t)); object->prev = object->next = NULL; @@ -103,27 +103,27 @@ _dl_finalize_object(const char *objname, Elf_Dyn *dynp, const long *dl_data, * the ones which have pointer values. */ if (object->Dyn.info[DT_PLTGOT]) - object->Dyn.info[DT_PLTGOT] += loff; + object->Dyn.info[DT_PLTGOT] += obase; if (object->Dyn.info[DT_HASH]) - object->Dyn.info[DT_HASH] += loff; + object->Dyn.info[DT_HASH] += obase; if (object->Dyn.info[DT_STRTAB]) - object->Dyn.info[DT_STRTAB] += loff; + object->Dyn.info[DT_STRTAB] += obase; if (object->Dyn.info[DT_SYMTAB]) - object->Dyn.info[DT_SYMTAB] += loff; + object->Dyn.info[DT_SYMTAB] += obase; if (object->Dyn.info[DT_RELA]) - object->Dyn.info[DT_RELA] += loff; + object->Dyn.info[DT_RELA] += obase; if (object->Dyn.info[DT_SONAME]) - object->Dyn.info[DT_SONAME] += loff; + object->Dyn.info[DT_SONAME] += obase; if (object->Dyn.info[DT_RPATH]) object->Dyn.info[DT_RPATH] += object->Dyn.info[DT_STRTAB]; if (object->Dyn.info[DT_REL]) - object->Dyn.info[DT_REL] += loff; + object->Dyn.info[DT_REL] += obase; if (object->Dyn.info[DT_INIT]) - object->Dyn.info[DT_INIT] += loff; + object->Dyn.info[DT_INIT] += obase; if (object->Dyn.info[DT_FINI]) - object->Dyn.info[DT_FINI] += loff; + object->Dyn.info[DT_FINI] += obase; if (object->Dyn.info[DT_JMPREL]) - object->Dyn.info[DT_JMPREL] += loff; + object->Dyn.info[DT_JMPREL] += obase; if (object->Dyn.info[DT_HASH] != 0) { Elf_Word *hashtab = (Elf_Word *)object->Dyn.info[DT_HASH]; @@ -139,8 +139,8 @@ _dl_finalize_object(const char *objname, Elf_Dyn *dynp, const long *dl_data, object->phdrc = dl_data[AUX_phnum]; } object->obj_type = objtype; - object->load_addr = laddr; - object->load_offs = loff; + object->load_base = lbase; + object->obj_base = obase; object->load_name = _dl_strdup(objname); if (_dl_loading_object == NULL) { /* @@ -274,7 +274,7 @@ _dl_find_symbol_bysym(elf_object_t *req_obj, unsigned int symidx, *pobj = sobj; if (_dl_prebind_validate) /* XXX */ prebind_validate(req_obj, symidx, flags, ref_sym); - return sobj->load_offs; + return sobj->obj_base; } sym = req_obj->dyn.symtab; @@ -430,7 +430,7 @@ found: if (pobj) *pobj = object; - return (object->load_offs); + return (object->obj_base); } int diff --git a/libexec/ld.so/resolve.h b/libexec/ld.so/resolve.h index 1257ffccae3..ac27d79a274 100644 --- a/libexec/ld.so/resolve.h +++ b/libexec/ld.so/resolve.h @@ -1,4 +1,4 @@ -/* $OpenBSD: resolve.h,v 1.55 2007/11/27 16:42:15 miod Exp $ */ +/* $OpenBSD: resolve.h,v 1.56 2008/04/09 21:45:26 kurt Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -49,13 +49,13 @@ struct load_list { */ typedef struct elf_object elf_object_t; struct elf_object { - Elf_Addr load_addr; /* Real load address */ + Elf_Addr obj_base; /* object's address '0' base */ char *load_name; /* Pointer to object name */ Elf_Dyn *load_dyn; /* Pointer to object dynamic data */ struct elf_object *next; struct elf_object *prev; /* End struct link_map compatible */ - Elf_Addr load_offs; /* Load offset from link address */ + Elf_Addr load_base; /* Base address of loadable segments */ struct load_list *load_list; @@ -152,7 +152,7 @@ void _dl_rt_resolve(void); void _dl_add_object(elf_object_t *object); elf_object_t *_dl_finalize_object(const char *objname, Elf_Dyn *dynp, - const long *, const int objtype, const long laddr, const long loff); + const long *, const int objtype, const long lbase, const long obase); void _dl_remove_object(elf_object_t *object); void _dl_cleanup_objects(void); diff --git a/libexec/ld.so/sh/rtld_machine.c b/libexec/ld.so/sh/rtld_machine.c index e7107cc5b57..dee90ab1b8d 100644 --- a/libexec/ld.so/sh/rtld_machine.c +++ b/libexec/ld.so/sh/rtld_machine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtld_machine.c,v 1.10 2008/02/24 15:47:47 drahn Exp $ */ +/* $OpenBSD: rtld_machine.c,v 1.11 2008/04/09 21:45:26 kurt Exp $ */ /* * Copyright (c) 2004 Dale Rahn @@ -604,7 +604,7 @@ _dl_md_reloc(elf_object_t *object, int rel, int relasz) Elf_RelA *rels; struct load_list *llist; - loff = object->load_offs; + loff = object->obj_base; numrela = object->Dyn.info[relasz] / sizeof(Elf_RelA); rels = (Elf_RelA *)(object->Dyn.info[rel]); @@ -812,8 +812,8 @@ _dl_md_reloc_got(elf_object_t *object, int lazy) for (i = 0; i < num/sizeof(Elf_Rel); i++, rel++) { Elf_Addr *where; - where = (Elf_Addr *)(rel->r_offset + object->load_offs); - *where += object->load_offs; + where = (Elf_Addr *)(rel->r_offset + object->obj_base); + *where += object->obj_base; } pltgot[1] = (Elf_Addr)object; @@ -854,7 +854,7 @@ _dl_bind(elf_object_t *object, int relidx) *((int *)0) = 0; /* XXX */ } - addr = (Elf_Addr *)(object->load_offs + rel->r_offset); + addr = (Elf_Addr *)(object->obj_base + rel->r_offset); newval = ooff + this->st_value; /* if GOT is protected, allow the write */ diff --git a/libexec/ld.so/sparc/rtld_machine.c b/libexec/ld.so/sparc/rtld_machine.c index 1438447cdaf..1e44efa51aa 100644 --- a/libexec/ld.so/sparc/rtld_machine.c +++ b/libexec/ld.so/sparc/rtld_machine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtld_machine.c,v 1.30 2008/02/24 15:47:47 drahn Exp $ */ +/* $OpenBSD: rtld_machine.c,v 1.31 2008/04/09 21:45:26 kurt Exp $ */ /* * Copyright (c) 1999 Dale Rahn @@ -184,7 +184,7 @@ _dl_md_reloc(elf_object_t *object, int rel, int relasz) Elf_RelA *relas; struct load_list *llist; - loff = object->load_offs; + loff = object->obj_base; numrela = object->Dyn.info[relasz] / sizeof(Elf_RelA); relas = (Elf_RelA *)(object->Dyn.info[rel]); @@ -324,7 +324,7 @@ _dl_bind(elf_object_t *object, int reloff) sym += ELF_R_SYM(rela->r_info); symn = object->dyn.strtab + sym->st_name; - addr = (Elf_Addr *)(object->load_offs + rela->r_offset); + addr = (Elf_Addr *)(object->obj_base + rela->r_offset); this = NULL; ooff = _dl_find_symbol(symn, &this, SYM_SEARCH_ALL|SYM_WARNNOTFOUND|SYM_PLT, sym, diff --git a/libexec/ld.so/sparc64/rtld_machine.c b/libexec/ld.so/sparc64/rtld_machine.c index 5693f9ce807..c1a3c2fa7cc 100644 --- a/libexec/ld.so/sparc64/rtld_machine.c +++ b/libexec/ld.so/sparc64/rtld_machine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtld_machine.c,v 1.41 2008/02/24 10:16:58 kettenis Exp $ */ +/* $OpenBSD: rtld_machine.c,v 1.42 2008/04/09 21:45:26 kurt Exp $ */ /* * Copyright (c) 1999 Dale Rahn @@ -210,7 +210,7 @@ _dl_md_reloc(elf_object_t *object, int rel, int relasz) Elf_RelA *relas; struct load_list *llist; - loff = object->load_offs; + loff = object->obj_base; numrela = object->Dyn.info[relasz] / sizeof(Elf64_Rela); relas = (Elf64_Rela *)(object->Dyn.info[rel]); @@ -617,7 +617,7 @@ _dl_bind(elf_object_t *object, int index) sym += ELF64_R_SYM(rela->r_info); symn = object->dyn.strtab + sym->st_name; - addr = (Elf_Word *)(object->load_offs + rela->r_offset); + addr = (Elf_Word *)(object->obj_base + rela->r_offset); this = NULL; ooff = _dl_find_symbol(symn, &this, SYM_SEARCH_ALL|SYM_WARNNOTFOUND|SYM_PLT, sym, |