xref: /freebsd/sys/arm/include/elf.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
1d4cfb421SDavid E. O'Brien /*-
2*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
3af3dc4a7SPedro F. Giffuni  *
4d4cfb421SDavid E. O'Brien  * Copyright (c) 2001 David E. O'Brien
5d4cfb421SDavid E. O'Brien  * Copyright (c) 1996-1997 John D. Polstra.
6d4cfb421SDavid E. O'Brien  * All rights reserved.
7d4cfb421SDavid E. O'Brien  *
8d4cfb421SDavid E. O'Brien  * Redistribution and use in source and binary forms, with or without
9d4cfb421SDavid E. O'Brien  * modification, are permitted provided that the following conditions
10d4cfb421SDavid E. O'Brien  * are met:
11d4cfb421SDavid E. O'Brien  * 1. Redistributions of source code must retain the above copyright
12d4cfb421SDavid E. O'Brien  *    notice, this list of conditions and the following disclaimer.
13d4cfb421SDavid E. O'Brien  * 2. Redistributions in binary form must reproduce the above copyright
14d4cfb421SDavid E. O'Brien  *    notice, this list of conditions and the following disclaimer in the
15d4cfb421SDavid E. O'Brien  *    documentation and/or other materials provided with the distribution.
16d4cfb421SDavid E. O'Brien  *
17d4cfb421SDavid E. O'Brien  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18d4cfb421SDavid E. O'Brien  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19d4cfb421SDavid E. O'Brien  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20d4cfb421SDavid E. O'Brien  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21d4cfb421SDavid E. O'Brien  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22d4cfb421SDavid E. O'Brien  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23d4cfb421SDavid E. O'Brien  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24d4cfb421SDavid E. O'Brien  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25d4cfb421SDavid E. O'Brien  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26d4cfb421SDavid E. O'Brien  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27d4cfb421SDavid E. O'Brien  * SUCH DAMAGE.
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 
62d4cfb421SDavid E. O'Brien #define	R_ARM_COUNT	33	/* Count of defined relocation types. */
63d4cfb421SDavid E. O'Brien 
64d4cfb421SDavid E. O'Brien /* Define "machine" characteristics */
65d4cfb421SDavid E. O'Brien #define	ELF_TARG_CLASS	ELFCLASS32
66ba282be9SOlivier Houchard #ifdef __ARMEB__
67ba282be9SOlivier Houchard #define	ELF_TARG_DATA	ELFDATA2MSB
68ba282be9SOlivier Houchard #else
69d4cfb421SDavid E. O'Brien #define	ELF_TARG_DATA	ELFDATA2LSB
70ba282be9SOlivier Houchard #endif
71d4cfb421SDavid E. O'Brien #define	ELF_TARG_MACH	EM_ARM
72d4cfb421SDavid E. O'Brien #define	ELF_TARG_VER	1
73d4cfb421SDavid E. O'Brien 
74817dc004SWarner Losh /* Defines specific for arm headers */
7534784d17SWarner Losh #define	EF_ARM_EABI_FREEBSD_MIN EF_ARM_EABI_VER4
76817dc004SWarner Losh 
77ca18304eSKonstantin Belousov #define	ET_DYN_LOAD_ADDR 0x01001000
7802306393SKonstantin Belousov 
7919e1bd01SJohn Baldwin /* Flags passed in AT_HWCAP. */
800cbf724eSMichal Meloun #define	HWCAP_SWP		0x00000001	/* Unsupported, never set.    */
810cbf724eSMichal Meloun #define	HWCAP_HALF		0x00000002	/* Always set.                */
820cbf724eSMichal Meloun #define	HWCAP_THUMB		0x00000004
830cbf724eSMichal Meloun #define	HWCAP_26BIT		0x00000008	/* Unsupported, never set.    */
840cbf724eSMichal Meloun #define	HWCAP_FAST_MULT		0x00000010	/* Always set.                */
850cbf724eSMichal Meloun #define	HWCAP_FPA		0x00000020	/* Unsupported, never set.    */
8619e1bd01SJohn Baldwin #define	HWCAP_VFP		0x00000040
870cbf724eSMichal Meloun #define	HWCAP_EDSP		0x00000080	/* Always set for ARMv6+.     */
880cbf724eSMichal Meloun #define	HWCAP_JAVA		0x00000100	/* Unsupported, never set.    */
890cbf724eSMichal Meloun #define	HWCAP_IWMMXT		0x00000200	/* Unsupported, never set.    */
900cbf724eSMichal Meloun #define	HWCAP_CRUNCH		0x00000400	/* Unsupported, never set.    */
910cbf724eSMichal Meloun #define	HWCAP_THUMBEE		0x00000800
9264f73a4cSJohn Baldwin #define	HWCAP_NEON		0x00001000
931e159074SJohn Baldwin #define	HWCAP_VFPv3		0x00002000
941e159074SJohn Baldwin #define	HWCAP_VFPv3D16		0x00004000
950cbf724eSMichal Meloun #define	HWCAP_TLS		0x00008000	/* Always set for ARMv6+.     */
960cbf724eSMichal Meloun #define	HWCAP_VFPv4		0x00010000
970cbf724eSMichal Meloun #define	HWCAP_IDIVA		0x00020000
980cbf724eSMichal Meloun #define	HWCAP_IDIVT		0x00040000
9919e1bd01SJohn Baldwin #define	HWCAP_VFPD32		0x00080000
1000cbf724eSMichal Meloun #define	HWCAP_IDIV		(HWCAP_IDIVA | HWCAP_IDIVT)
1010cbf724eSMichal Meloun #define	HWCAP_LPAE		0x00100000
1020cbf724eSMichal Meloun #define	HWCAP_EVTSTRM		0x00200000	/* Not implemented yet.       */
1030cbf724eSMichal Meloun 
1040cbf724eSMichal Meloun /* Flags passed in AT_HWCAP2. */
1050cbf724eSMichal Meloun #define	HWCAP2_AES		0x00000001
1060cbf724eSMichal Meloun #define	HWCAP2_PMULL		0x00000002
1070cbf724eSMichal Meloun #define	HWCAP2_SHA1		0x00000004
1080cbf724eSMichal Meloun #define	HWCAP2_SHA2		0x00000008
1090cbf724eSMichal Meloun #define	HWCAP2_CRC32		0x00000010
11019e1bd01SJohn Baldwin 
111d4cfb421SDavid E. O'Brien #endif /* !_MACHINE_ELF_H_ */
112