summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/ld/ns32k/md-static-funcs.c
blob: cd540daa28467bf6d7c4393e848d9e23e3df88f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* *	$OpenBSD: md-static-funcs.c,v 1.2 1998/03/26 19:47:12 niklas Exp $*/
/*
 *
 * Called by ld.so when onanating.
 * This *must* be a static function, so it is not called through a jmpslot.
 */

#include <sys/syscall.h>
#define write(fd, s, n)		__syscall(SYS_write, (fd), (s), (n))
#define _exit(n)		__syscall(SYS_exit, (n))

asm("___syscall:");
asm("	movd tos,r1");		/* return address */
asm("	movd tos,r0");		/* syscall number */
asm("	movd r1,tos");
asm("	svc");			/* do system call */
asm("	bcc 1f");		/* check error */
asm("	movqd -1,r0");
asm("1:	jump 0(0(sp))");	/* return */

static void
md_relocate_simple(r, relocation, addr)
struct relocation_info	*r;
long			relocation;
char			*addr;
{
    if (r->r_relative) {
    	if (r->r_disp != 2) {
    		write(2, "Illegal runtime relocation for ld.so",
		      sizeof("Illegal runtime relocation for ld.so") - 1);
		_exit(1);
    	}
	*(long *)addr += relocation;
    }
}

#undef _exit
#undef write