diff options
author | Per Fogelstrom <pefo@cvs.openbsd.org> | 2002-10-25 10:39:53 +0000 |
---|---|---|
committer | Per Fogelstrom <pefo@cvs.openbsd.org> | 2002-10-25 10:39:53 +0000 |
commit | 60749b6964e1a9fd44c203d14fc38e17f75e9360 (patch) | |
tree | 72f691993876fbe39d4d8b1fae986a6314daa44d /libexec/ld.so | |
parent | ac8382267e13d0855e60c33368e17c9f23511cab (diff) |
Some small fixes in MI code for mips backport. A new reloc md function,
RELOC_GOT, was added to handle mips got bootstrap reloc.
Also remove workaround used on previous versions of binutils for mips.
Diffstat (limited to 'libexec/ld.so')
-rw-r--r-- | libexec/ld.so/alpha/archdep.h | 4 | ||||
-rw-r--r-- | libexec/ld.so/i386/archdep.h | 4 | ||||
-rw-r--r-- | libexec/ld.so/loader.c | 51 | ||||
-rw-r--r-- | libexec/ld.so/mips/rtld_machine.c | 3 | ||||
-rw-r--r-- | libexec/ld.so/powerpc/archdep.h | 4 | ||||
-rw-r--r-- | libexec/ld.so/sparc/archdep.h | 4 | ||||
-rw-r--r-- | libexec/ld.so/sparc64/archdep.h | 4 |
7 files changed, 24 insertions, 50 deletions
diff --git a/libexec/ld.so/alpha/archdep.h b/libexec/ld.so/alpha/archdep.h index 510da23b5ec..144378a1f5b 100644 --- a/libexec/ld.so/alpha/archdep.h +++ b/libexec/ld.so/alpha/archdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: archdep.h,v 1.7 2002/08/12 01:05:23 drahn Exp $ */ +/* $OpenBSD: archdep.h,v 1.8 2002/10/25 10:39:52 pefo Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -76,4 +76,6 @@ RELOC_RELA(Elf64_Rela *r, const Elf64_Sym *s, Elf64_Addr *p, unsigned long v) } } +#define RELOC_GOT(obj, offs) + #endif /* _ALPHA_ARCHDEP_H_ */ diff --git a/libexec/ld.so/i386/archdep.h b/libexec/ld.so/i386/archdep.h index 006d876c739..f62afbcde9c 100644 --- a/libexec/ld.so/i386/archdep.h +++ b/libexec/ld.so/i386/archdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: archdep.h,v 1.1 2002/08/23 23:02:48 drahn Exp $ */ +/* $OpenBSD: archdep.h,v 1.2 2002/10/25 10:39:52 pefo Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -85,4 +85,6 @@ RELOC_RELA(Elf32_Rela *r, const Elf32_Sym *s, Elf32_Addr *p, unsigned long v) } } +#define RELOC_GOT(obj, offs) + #endif /* _I386_ARCHDEP_H_ */ diff --git a/libexec/ld.so/loader.c b/libexec/ld.so/loader.c index eb2e4f5f8cf..53cea0c1270 100644 --- a/libexec/ld.so/loader.c +++ b/libexec/ld.so/loader.c @@ -1,4 +1,4 @@ -/* $OpenBSD: loader.c,v 1.50 2002/10/21 16:01:55 drahn Exp $ */ +/* $OpenBSD: loader.c,v 1.51 2002/10/25 10:39:51 pefo Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -187,8 +187,9 @@ _dl_boot(const char **argv, char **envp, const long loff, long *dl_data) (Elf_Dyn *)phdp->p_vaddr, dl_data, OBJTYPE_EXE, 0, 0); } - if (phdp->p_type == PT_INTERP) + else if (phdp->p_type == PT_INTERP) { us = _dl_strdup((char *)phdp->p_vaddr); + } phdp++; } @@ -349,7 +350,7 @@ _dl_boot_bind(const long sp, long *dl_data) continue; dl_data[auxstack->au_id] = auxstack->au_v; } - loff = dl_data[AUX_base]; + loff = dl_data[AUX_base]; /* XXX assumes linked at 0x0 */ /* * We need to do 'selfreloc' in case the code weren't @@ -483,6 +484,9 @@ _dl_boot_bind(const long sp, long *dl_data) rp++; } } + + RELOC_GOT(&dynld, loff); + /* * we have been fully relocated here, so most things no longer * need the loff adjustment @@ -510,56 +514,15 @@ _dl_rtld(elf_object_t *object) void _dl_call_init(elf_object_t *object) { - Elf_Addr ooff; - const Elf_Sym *sym; - if (object->next) _dl_call_init(object->next); if (object->status & STAT_INIT_DONE) return; -#ifndef __mips__ if (object->dyn.init) (*object->dyn.init)(); -/* - * XXX We perform relocation of DTOR/CTOR. This is a ld bug problem - * XXX that should be fixed. - */ - sym = NULL; - ooff = _dl_find_symbol("__CTOR_LIST__", object, &sym, - SYM_SEARCH_SELF|SYM_WARNNOTFOUND|SYM_PLT, 0); - if (sym != NULL) { - int i = *(int *)(sym->st_value + ooff); - while (i--) - *(int *)(sym->st_value + ooff + 4 + 4 * i) += ooff; - } - sym = NULL; - ooff = _dl_find_symbol("__DTOR_LIST__", object, &sym, - SYM_SEARCH_SELF|SYM_WARNNOTFOUND|SYM_PLT, 0); - if (sym != NULL) { - int i = *(int *)(sym->st_value + ooff); - while (i--) - *(int *)(sym->st_value + ooff + 4 + 4 * i) += ooff; - } -/* - * XXX We should really call any code which resides in the .init segment - * XXX but at the moment this functionality is not provided by the toolchain. - * XXX Instead we rely on a symbol named '.init' and call it if it exists. - */ - sym = NULL; - ooff = _dl_find_symbol(".init", object, &sym, - SYM_SEARCH_SELF|SYM_WARNNOTFOUND|SYM_PLT, 0); - if (sym != NULL) { - DL_DEB(("calling .init in '%s'\n",object->load_name)); - (*(void(*)(void))(sym->st_value + ooff))(); - } -#if 0 /*XXX*/ - if (object->dyn.init) - (*object->dyn.init)(); -#endif -#endif /* __mips__ */ object->status |= STAT_INIT_DONE; } diff --git a/libexec/ld.so/mips/rtld_machine.c b/libexec/ld.so/mips/rtld_machine.c index fd8b178bd2e..9c3eb01fe58 100644 --- a/libexec/ld.so/mips/rtld_machine.c +++ b/libexec/ld.so/mips/rtld_machine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtld_machine.c,v 1.7 2002/10/23 12:38:29 pefo Exp $ */ +/* $OpenBSD: rtld_machine.c,v 1.8 2002/10/25 10:39:52 pefo Exp $ */ /* * Copyright (c) 1998-2002 Opsycon AB, Sweden. @@ -166,6 +166,7 @@ _dl_md_reloc_got(elf_object_t *object, int lazy) while (n--) { if (symp->st_shndx == SHN_UNDEF && ELF32_ST_TYPE(symp->st_info) == STT_FUNC) { +DL_DEB(("got: '%s' = %x\n", strt + symp->st_name, symp->st_value)); if (symp->st_value == 0 || !lazy) { this = 0; ooff = _dl_find_symbol(strt + symp->st_name, diff --git a/libexec/ld.so/powerpc/archdep.h b/libexec/ld.so/powerpc/archdep.h index 8107d1af87f..cb367e4f3a8 100644 --- a/libexec/ld.so/powerpc/archdep.h +++ b/libexec/ld.so/powerpc/archdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: archdep.h,v 1.9 2002/08/12 01:05:23 drahn Exp $ */ +/* $OpenBSD: archdep.h,v 1.10 2002/10/25 10:39:52 pefo Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -102,4 +102,6 @@ RELOC_RELA(Elf32_Rela *r, const Elf32_Sym *s, Elf32_Addr *p, unsigned long v) } } +#define RELOC_GOT(obj, offs) + #endif /* _POWERPC_ARCHDEP_H_ */ diff --git a/libexec/ld.so/sparc/archdep.h b/libexec/ld.so/sparc/archdep.h index a001a357e0b..4191ba5f7d2 100644 --- a/libexec/ld.so/sparc/archdep.h +++ b/libexec/ld.so/sparc/archdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: archdep.h,v 1.3 2002/08/12 01:05:23 drahn Exp $ */ +/* $OpenBSD: archdep.h,v 1.4 2002/10/25 10:39:52 pefo Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -77,4 +77,6 @@ RELOC_RELA(Elf_RelA *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v) } } +#define RELOC_GOT(obj, offs) + #endif /* _SPARC_ARCHDEP_H_ */ diff --git a/libexec/ld.so/sparc64/archdep.h b/libexec/ld.so/sparc64/archdep.h index 2c56ffe9d02..dc174b56d7d 100644 --- a/libexec/ld.so/sparc64/archdep.h +++ b/libexec/ld.so/sparc64/archdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: archdep.h,v 1.13 2002/08/12 01:05:23 drahn Exp $ */ +/* $OpenBSD: archdep.h,v 1.14 2002/10/25 10:39:52 pefo Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -76,4 +76,6 @@ RELOC_RELA(Elf_RelA *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v) } } +#define RELOC_GOT(obj, offs) + #endif /* _SPARC64_ARCHDEP_H_ */ |