diff options
author | Per Fogelstrom <pefo@cvs.openbsd.org> | 2002-10-23 12:38:30 +0000 |
---|---|---|
committer | Per Fogelstrom <pefo@cvs.openbsd.org> | 2002-10-23 12:38:30 +0000 |
commit | db0dfc1e5e65b8f62e7ee1c09359956563d37ec3 (patch) | |
tree | d425f8772f69efaa117ec5b738e45de077e76777 /libexec/ld.so/mips/archdep.h | |
parent | 45e5a93b6f8946f30d58f6e53d1c6ab1d84c4b62 (diff) |
mips archdep stuff update while waiting for ok on mi
Diffstat (limited to 'libexec/ld.so/mips/archdep.h')
-rw-r--r-- | libexec/ld.so/mips/archdep.h | 61 |
1 files changed, 57 insertions, 4 deletions
diff --git a/libexec/ld.so/mips/archdep.h b/libexec/ld.so/mips/archdep.h index f25c00f51dd..929325909b7 100644 --- a/libexec/ld.so/mips/archdep.h +++ b/libexec/ld.so/mips/archdep.h @@ -1,7 +1,7 @@ -/* $OpenBSD: archdep.h,v 1.3 2002/05/24 03:44:37 deraadt Exp $ */ +/* $OpenBSD: archdep.h,v 1.4 2002/10/23 12:38:29 pefo Exp $ */ /* - * Copyright (c) 1998 Per Fogelstrom, Opsycon AB + * Copyright (c) 1998-2002 Opsycon AB, Sweden. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -13,8 +13,7 @@ * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed under OpenBSD by - * Per Fogelstrom, Opsycon AB, Sweden. + * This product includes software developed by Opsycon AB, Sweden. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * @@ -35,7 +34,11 @@ #ifndef _MIPS_ARCHDEP_H_ #define _MIPS_ARCHDEP_H_ +#include <link.h> +#include <machine/reloc.h> + #include "syscall.h" +#include "resolve.h" #include "util.h" #define DL_MALLOC_ALIGN 4 /* Arch constraint or otherwise */ @@ -45,4 +48,54 @@ #define RELTYPE Elf32_Rel #define RELSIZE sizeof(Elf32_Rel) +static inline void +RELOC_REL(Elf_Rel *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v) +{ +} + +static inline void +RELOC_RELA(Elf32_Rela *r, const Elf32_Sym *s, Elf32_Addr *p, unsigned long v) +{ + _dl_exit(20); +} + +struct elf_object; + +static inline void +RELOC_GOT(struct elf_object *dynld, long loff) +{ + Elf32_Addr *gotp; + int i, n; + const Elf_Sym *sp; + + /* Do all local gots */ + gotp = dynld->dyn.pltgot; + n = dynld->Dyn.info[DT_MIPS_LOCAL_GOTNO - DT_LOPROC + DT_NUM]; + + for (i = ((gotp[1] & 0x80000000) ? 2 : 1); i < n; i++) { + gotp[i] += loff; + } + gotp += n; + + /* Do symbol referencing gots. There should be no global... */ + n = dynld->Dyn.info[DT_MIPS_SYMTABNO - DT_LOPROC + DT_NUM] - + dynld->Dyn.info[DT_MIPS_GOTSYM - DT_LOPROC + DT_NUM]; + sp = dynld->dyn.symtab; + sp += dynld->Dyn.info[DT_MIPS_GOTSYM - DT_LOPROC + DT_NUM]; + + while (n--) { + if (sp->st_shndx == SHN_UNDEF || + sp->st_shndx == SHN_COMMON) { + _dl_exit(6); + } else if (ELF32_ST_TYPE(sp->st_info) == STT_FUNC) { + *gotp += loff; + } else { + *gotp = sp->st_value + loff; + } + gotp++; + sp++; + } + dynld->status |= STAT_GOT_DONE; +} + #endif /* _MIPS_ARCHDEP_H_ */ |