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