elf_machdep.h revision 1.1 1 /* $NetBSD: elf_machdep.h,v 1.1 2014/09/03 19:34:26 matt Exp $ */
2
3 /*-
4 * Copyright (c) 2014 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matt Thomas of 3am Software Foundry.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32 #ifndef _OR1K_ELF_MACHDEP_H_
33 #define _OR1K_ELF_MACHDEP_H_
34
35 #define ELF32_MACHDEP_ID EM_OR1K
36
37 #define ELF32_MACHDEP_ENDIANNESS ELFDATA2MSB
38 #define ELF64_MACHDEP_ENDIANNESS xxx
39
40 #define ELF32_MACHDEP_ID_CASES \
41 case EM_OR1K: \
42 break;
43
44 #define ELF64_MACHDEP_ID_CASES
45
46 #define ARCH_ELFSIZE 32 /* MD native binary size */
47
48 /* Processor specific flags for the ELF header e_flags field. */
49
50 #define EF_OR1K_NODELAY 0x00000001
51
52 /* Processor specific relocation types */
53
54 #define R_OR1K_NONE 0
55 #define R_OR1K_32 1 // A
56 #define R_OR1K_16 2 // A & 0xffff
57 #define R_OR1K_8 3 // A & 0xff
58 #define R_OR1K_LO_16_IN_INSN 4 // A & 0xffff
59 #define R_OR1K_HI_16_IN_INSN 5 // (A >> 16) & 0xffff
60 #define R_OR1K_INSN_REL_26 6 // (S + A - P) >> 2
61 #define R_OR1K_GNU_VTENTRY 7
62 #define R_OR1K_GNU_VTINHERIT 8
63 #define R_OR1K_32_PCREL 9 // A - P
64 #define R_OR1K_16_PCREL 10 // (A - P) & 0xffff
65 #define R_OR1K_8_PCREL 11 // (A - P) & 0xff
66 #define R_OR1K_GOTPC_HI16 12
67 #define R_OR1K_GOTPC_LO16 13
68 #define R_OR1K_GOT15 14
69 #define R_OR1K_PLT26 15
70 #define R_OR1K_GOTOFF_HI16 16
71 #define R_OR1K_GOTOFF_LO16 17
72 #define R_OR1K_COPY 18
73 #define R_OR1K_GLOB_DAT 19
74 #define R_OR1K_JMP_SLOT 20
75 #define R_OR1K_RELATIVE 21
76 #define R_OR1K_TLS_GD_HI16 22
77 #define R_OR1K_TLS_GD_LO16 23
78 #define R_OR1K_TLS_LDM_HI16 24
79 #define R_OR1K_TLS_LDM_LO16 25
80 #define R_OR1K_TLS_LDO_HI16 26
81 #define R_OR1K_TLS_LDO_LO16 27
82 #define R_OR1K_TLS_IE_HI16 28
83 #define R_OR1K_TLS_IE_LO16 29
84 #define R_OR1K_TLS_LE_HI16 30
85 #define R_OR1K_TLS_LE_LO16 31
86 #define R_OR1K_TLS_TPOFF 32
87 #define R_OR1K_TLS_DTPOFF 33
88 #define R_OR1K_TLS_DTPMOD 34
89
90 #define R_TYPE(name) R_OR1K_ ## name
91 #define R_TLS_TYPE(name) R_OR1K_ ## name ## 64
92
93 #endif /* _OR1K_ELF_MACHDEP_H_ */
94