diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-10-18 08:53:40 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-10-18 08:53:40 +0000 |
commit | d6583bb2a13f329cf0332ef2570eb8bb8fc0e39c (patch) | |
tree | ece253b876159b39c620e62b6c9b1174642e070e /gnu/usr.bin/ld/sparc/md-static-funcs.c |
initial import of NetBSD tree
Diffstat (limited to 'gnu/usr.bin/ld/sparc/md-static-funcs.c')
-rw-r--r-- | gnu/usr.bin/ld/sparc/md-static-funcs.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/gnu/usr.bin/ld/sparc/md-static-funcs.c b/gnu/usr.bin/ld/sparc/md-static-funcs.c new file mode 100644 index 00000000000..f5e07622bbf --- /dev/null +++ b/gnu/usr.bin/ld/sparc/md-static-funcs.c @@ -0,0 +1,37 @@ + +/* + * $Id: md-static-funcs.c,v 1.1 1995/10/18 08:40:58 deraadt Exp $ + * + * Simple SPARC relocations for the benefit of self-relocation of ld.so + * avoiding the use of global variables (ie. reloc_bitshift[] et. al.). + * Only types supported are RELOC_32 and RELOC_RELATIVE. + * + * This *must* be a static function, so it is not called through a jmpslot. + */ +static void +md_relocate_simple(r, relocation, addr) +struct relocation_info *r; +long relocation; +char *addr; +{ + register unsigned long mask; + register unsigned long shift; + + switch (r->r_type) { + case RELOC_32: + mask = 0xffffffff; + shift = 0; + break; + case RELOC_RELATIVE: + mask = 0x003fffff; + shift = 10; + break; + } + relocation += (*(long *)addr & mask) << shift; + relocation >>= shift; + relocation &= mask; + + *(long *) (addr) &= ~mask; + *(long *) (addr) |= relocation; +} + |