archdep.h revision 1.14
1/*	$OpenBSD: archdep.h,v 1.14 2002/10/25 10:39:52 pefo Exp $ */
2
3/*
4 * Copyright (c) 1998 Per Fogelstrom, Opsycon AB
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 *    notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 *    notice, this list of conditions and the following disclaimer in the
13 *    documentation and/or other materials provided with the distribution.
14 * 3. All advertising materials mentioning features or use of this software
15 *    must display the following acknowledgement:
16 *	This product includes software developed under OpenBSD by
17 *	Per Fogelstrom, Opsycon AB, Sweden.
18 * 4. The name of the author may not be used to endorse or promote products
19 *    derived from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
22 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
25 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 */
34
35#ifndef _SPARC64_ARCHDEP_H_
36#define _SPARC64_ARCHDEP_H_
37
38#define	DL_MALLOC_ALIGN	8	/* Arch constraint or otherwise */
39
40#define	MACHID	EM_SPARCV9	/* ELF e_machine ID value checked */
41
42#define	RELTYPE	Elf64_Rela
43#define	RELSIZE	sizeof(Elf64_Rela)
44
45#include <elf_abi.h>
46#include <machine/exec.h>
47#include <machine/reloc.h>
48#include <sys/syscall.h>
49#include "syscall.h"
50#include "util.h"
51
52static inline void *
53_dl_mmap(void *addr, unsigned int len, unsigned int prot,
54	unsigned int flags, int fd, off_t offset)
55{
56	return((void *)_dl__syscall((quad_t)SYS_mmap, addr, len, prot,
57		flags, fd, 0, offset));
58}
59
60static inline void
61RELOC_REL(Elf_Rel *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v)
62{
63	/* SPARC64 does not use REL type relocations */
64	_dl_exit(20);
65}
66
67static inline void
68RELOC_RELA(Elf_RelA *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v)
69{
70	if (ELF_R_TYPE(r->r_info) == RELOC_RELATIVE) {
71		*p = v + r->r_addend;
72	} else {
73		/* XXX - printf might not work here, but we give it a shot. */
74		_dl_printf("Unknown bootstrap relocation.\n");
75		_dl_exit(6);
76	}
77}
78
79#define RELOC_GOT(obj, offs)
80
81#endif /* _SPARC64_ARCHDEP_H_ */
82