Sync usage with man page.
[netbsd-mini2440.git] / libexec / ld.aout_so / arch / sparc / md-static-funcs.c
blob19e95db7287bf9df7468741f588bc635798ccd25
1 /* $NetBSD: md-static-funcs.c,v 1.3 1998/01/05 22:00:45 cgd Exp $ */
3 /*
4 * Simple SPARC relocations for the benefit of self-relocation of ld.so
5 * avoiding the use of global variables (ie. reloc_bitshift[] et. al.).
6 * Only types supported are RELOC_32 and RELOC_RELATIVE.
8 * This *must* be a static function, so it is not called through a jmpslot.
9 */
10 static void
11 md_relocate_simple(r, relocation, addr)
12 struct relocation_info *r;
13 long relocation;
14 char *addr;
16 unsigned long mask;
17 unsigned long shift;
19 switch (r->r_type) {
20 case RELOC_32:
21 mask = 0xffffffff;
22 shift = 0;
23 break;
24 case RELOC_RELATIVE:
25 mask = 0x003fffff;
26 shift = 10;
27 break;
28 default:
29 return;
31 relocation += (*(long *)addr & mask) << shift;
32 relocation >>= shift;
33 relocation &= mask;
35 *(long *) (addr) &= ~mask;
36 *(long *) (addr) |= relocation;