xref: /freebsd/sys/arm/include/elf.h (revision 023063938a37626ac34610fc9e03cc735233b62d)
1d4cfb421SDavid E. O'Brien /*-
2d4cfb421SDavid E. O'Brien  * Copyright (c) 2001 David E. O'Brien
3d4cfb421SDavid E. O'Brien  * Copyright (c) 1996-1997 John D. Polstra.
4d4cfb421SDavid E. O'Brien  * All rights reserved.
5d4cfb421SDavid E. O'Brien  *
6d4cfb421SDavid E. O'Brien  * Redistribution and use in source and binary forms, with or without
7d4cfb421SDavid E. O'Brien  * modification, are permitted provided that the following conditions
8d4cfb421SDavid E. O'Brien  * are met:
9d4cfb421SDavid E. O'Brien  * 1. Redistributions of source code must retain the above copyright
10d4cfb421SDavid E. O'Brien  *    notice, this list of conditions and the following disclaimer.
11d4cfb421SDavid E. O'Brien  * 2. Redistributions in binary form must reproduce the above copyright
12d4cfb421SDavid E. O'Brien  *    notice, this list of conditions and the following disclaimer in the
13d4cfb421SDavid E. O'Brien  *    documentation and/or other materials provided with the distribution.
14d4cfb421SDavid E. O'Brien  *
15d4cfb421SDavid E. O'Brien  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16d4cfb421SDavid E. O'Brien  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17d4cfb421SDavid E. O'Brien  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18d4cfb421SDavid E. O'Brien  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19d4cfb421SDavid E. O'Brien  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20d4cfb421SDavid E. O'Brien  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21d4cfb421SDavid E. O'Brien  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22d4cfb421SDavid E. O'Brien  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23d4cfb421SDavid E. O'Brien  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24d4cfb421SDavid E. O'Brien  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25d4cfb421SDavid E. O'Brien  * SUCH DAMAGE.
26d4cfb421SDavid E. O'Brien  *
27d4cfb421SDavid E. O'Brien  * $FreeBSD$
28d4cfb421SDavid E. O'Brien  */
29d4cfb421SDavid E. O'Brien 
30d4cfb421SDavid E. O'Brien #ifndef _MACHINE_ELF_H_
31d4cfb421SDavid E. O'Brien #define	_MACHINE_ELF_H_ 1
32d4cfb421SDavid E. O'Brien 
33d4cfb421SDavid E. O'Brien /*
34d4cfb421SDavid E. O'Brien  * EABI ELF definitions for the StrongARM architecture.
35d4cfb421SDavid E. O'Brien  * See "ARM ELF", document no. `SWS ESPC 0003 A-08' for details.
36d4cfb421SDavid E. O'Brien  */
37d4cfb421SDavid E. O'Brien 
38d4cfb421SDavid E. O'Brien #include <sys/elf32.h>	/* Definitions common to all 32 bit architectures. */
39d4cfb421SDavid E. O'Brien 
40d4cfb421SDavid E. O'Brien #define	__ELF_WORD_SIZE	32	/* Used by <sys/elf_generic.h> */
41d4cfb421SDavid E. O'Brien #include <sys/elf_generic.h>
42d4cfb421SDavid E. O'Brien 
436e695cecSOlivier Houchard typedef struct {        /* Auxiliary vector entry on initial stack */
446e695cecSOlivier Houchard 	int     a_type;                 /* Entry type. */
456e695cecSOlivier Houchard 	union {
466e695cecSOlivier Houchard 		long    a_val;          /* Integer value. */
476e695cecSOlivier Houchard 		void    *a_ptr;         /* Address. */
486e695cecSOlivier Houchard 		void    (*a_fcn)(void); /* Function pointer (not used). */
496e695cecSOlivier Houchard 	} a_un;
506e695cecSOlivier Houchard } Elf32_Auxinfo;
516e695cecSOlivier Houchard 
526e695cecSOlivier Houchard __ElfType(Auxinfo);
536e695cecSOlivier Houchard 
54d4cfb421SDavid E. O'Brien #define	ELF_ARCH	EM_ARM
55d4cfb421SDavid E. O'Brien 
56d4cfb421SDavid E. O'Brien #define	ELF_MACHINE_OK(x) ((x) == EM_ARM)
57d4cfb421SDavid E. O'Brien 
58d4cfb421SDavid E. O'Brien /*
59d4cfb421SDavid E. O'Brien  * Relocation types.
60d4cfb421SDavid E. O'Brien  */
61d4cfb421SDavid E. O'Brien 
626e695cecSOlivier Houchard /* Values for a_type. */
636e695cecSOlivier Houchard #define AT_NULL         0       /* Terminates the vector. */
646e695cecSOlivier Houchard #define AT_IGNORE       1       /* Ignored entry. */
656e695cecSOlivier Houchard #define AT_EXECFD       2       /* File descriptor of program to load. */
666e695cecSOlivier Houchard #define AT_PHDR         3       /* Program header of program already loaded. */
676e695cecSOlivier Houchard #define AT_PHENT        4       /* Size of each program header entry. */
686e695cecSOlivier Houchard #define AT_PHNUM        5       /* Number of program header entries. */
696e695cecSOlivier Houchard #define AT_PAGESZ       6       /* Page size in bytes. */
706e695cecSOlivier Houchard #define AT_BASE         7       /* Interpreter's base address. */
716e695cecSOlivier Houchard #define AT_FLAGS        8       /* Flags (unused). */
726e695cecSOlivier Houchard #define AT_ENTRY        9       /* Where interpreter should transfer control. */
736e695cecSOlivier Houchard #define AT_NOTELF       10      /* Program is not ELF ?? */
746e695cecSOlivier Houchard #define AT_UID          11      /* Real uid. */
756e695cecSOlivier Houchard #define AT_EUID         12      /* Effective uid. */
766e695cecSOlivier Houchard #define AT_GID          13      /* Real gid. */
776e695cecSOlivier Houchard #define AT_EGID         14      /* Effective gid. */
78a4f2b2b0SKonstantin Belousov #define	AT_EXECPATH	15	/* Path to the executable. */
796e695cecSOlivier Houchard 
80a4f2b2b0SKonstantin Belousov #define AT_COUNT        16      /* Count of defined aux entry types. */
816e695cecSOlivier Houchard 
82d4cfb421SDavid E. O'Brien #define	R_ARM_COUNT		33	/* Count of defined relocation types. */
83d4cfb421SDavid E. O'Brien 
84d4cfb421SDavid E. O'Brien 
85d4cfb421SDavid E. O'Brien /* Define "machine" characteristics */
86d4cfb421SDavid E. O'Brien #define	ELF_TARG_CLASS	ELFCLASS32
87ba282be9SOlivier Houchard #ifdef __ARMEB__
88ba282be9SOlivier Houchard #define	ELF_TARG_DATA	ELFDATA2MSB
89ba282be9SOlivier Houchard #else
90d4cfb421SDavid E. O'Brien #define	ELF_TARG_DATA	ELFDATA2LSB
91ba282be9SOlivier Houchard #endif
92d4cfb421SDavid E. O'Brien #define	ELF_TARG_MACH	EM_ARM
93d4cfb421SDavid E. O'Brien #define	ELF_TARG_VER	1
94d4cfb421SDavid E. O'Brien 
95ce4210d6SOlivier Houchard /*
96ce4210d6SOlivier Houchard  * Magic number for the elf trampoline, chosen wisely to be an immediate
97ce4210d6SOlivier Houchard  * value.
98ce4210d6SOlivier Houchard  */
99ce4210d6SOlivier Houchard #define MAGIC_TRAMP_NUMBER	0x5c000003
10002306393SKonstantin Belousov 
10102306393SKonstantin Belousov #define	ET_DYN_LOAD_ADDR 0x12000
10202306393SKonstantin Belousov 
103d4cfb421SDavid E. O'Brien #endif /* !_MACHINE_ELF_H_ */
104