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
|
/* * $OpenBSD: md-static-funcs.c,v 1.3 2002/07/19 19:28:12 marc 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(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
|