elf.h revision 84783
1/*-
2 * Copyright (c) 2001 David E. O'Brien
3 * Copyright (c) 1996-1997 John D. Polstra.
4 * All rights reserved.
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 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 * $FreeBSD: head/sys/arm/include/elf.h 84783 2001-10-10 23:06:54Z ps $
28 */
29
30#ifndef _MACHINE_ELF_H_
31#define	_MACHINE_ELF_H_ 1
32
33/*
34 * EABI ELF definitions for the StrongARM architecture.
35 * See "ARM ELF", document no. `SWS ESPC 0003 A-08' for details.
36 */
37
38#include <sys/elf32.h>	/* Definitions common to all 32 bit architectures. */
39
40#define	__ELF_WORD_SIZE	32	/* Used by <sys/elf_generic.h> */
41#include <sys/elf_generic.h>
42
43#define	ELF_ARCH	EM_ARM
44
45#define	ELF_MACHINE_OK(x) ((x) == EM_ARM)
46
47/*
48 * Relocation types.
49 */
50
51#define	R_ARM_NONE		0	/* No relocation. */
52#define	R_ARM_PC24		1
53#define	R_ARM_ABS32		2
54#define	R_ARM_REL32		3
55#define	R_ARM_PC13		4
56#define	R_ARM_ABS16		5
57#define	R_ARM_ABS12		6
58#define	R_ARM_THM_ABS5		7
59#define	R_ARM_ABS8		8
60#define	R_ARM_SBREL32		9
61#define	R_ARM_THM_PC22		10
62#define	R_ARM_THM_PC8		11
63#define	R_ARM_AMP_VCALL9	12
64#define	R_ARM_SWI24		13
65#define	R_ARM_THM_SWI8		14
66#define	R_ARM_XPC25		15
67#define	R_ARM_THM_XPC22		16
68#define	R_ARM_COPY		20	/* Copy data from shared object. */
69#define	R_ARM_GLOB_DAT		21	/* Set GOT entry to data address. */
70#define	R_ARM_JUMP_SLOT		22	/* Set GOT entry to code address. */
71#define	R_ARM_RELATIVE		23	/* Add load address of shared object. */
72#define	R_ARM_GOTOFF		24	/* Add GOT-relative symbol address. *
73#define	R_ARM_GOTPC		25	/* Add PC-relative GOT table address. */
74#define	R_ARM_GOT32		26	/* Add PC-relative GOT offset. */
75#define	R_ARM_PLT32		27	/* Add PC-relative PLT offset. */
76#define	R_ARM_GNU_VTENTRY	100
77#define	R_ARM_GNU_VTINHERIT	101
78#define	R_ARM_RSBREL32		250
79#define	R_ARM_THM_RPC22		251
80#define	R_ARM_RREL32		252
81#define	R_ARM_RABS32		253
82#define	R_ARM_RPC24		254
83#define	R_ARM_RBASE		255
84
85#define	R_ARM_COUNT		33	/* Count of defined relocation types. */
86
87
88/* Define "machine" characteristics */
89#define	ELF_TARG_CLASS	ELFCLASS32
90#define	ELF_TARG_DATA	ELFDATA2LSB
91#define	ELF_TARG_MACH	EM_ARM
92#define	ELF_TARG_VER	1
93
94#ifdef _KERNEL
95
96/*
97 * On the StrongARM we load the dynamic linker where a userland call
98 * to mmap(0, ...) would put it.  The rationale behind this
99 * calculation is that it leaves room for the heap to grow to
100 * its maximum allowed size.
101 */
102#define	ELF_RTLD_ADDR(vmspace) \
103    (round_page((vm_offset_t)(vmspace)->vm_daddr + maxdsiz))
104
105#endif /* _KERNEL */
106#endif /* !_MACHINE_ELF_H_ */
107