blob: e29c48155689faa3972b04ad6ff8d07ecd6839a0 [file] [log] [blame]
Elliott Hughesa6a3ac52013-01-29 15:02:50 -08001/* $NetBSD: elf_machdep.h,v 1.15 2011/03/15 07:39:22 matt Exp $ */
2
3#ifndef _MIPS_ELF_MACHDEP_H_
4#define _MIPS_ELF_MACHDEP_H_
5
Elliott Hughesa6a3ac52013-01-29 15:02:50 -08006/* mips relocs. */
7
8#define R_MIPS_NONE 0
9#define R_MIPS_16 1
10#define R_MIPS_32 2
11#define R_MIPS_REL32 3
12#define R_MIPS_REL R_MIPS_REL32
13#define R_MIPS_26 4
14#define R_MIPS_HI16 5 /* high 16 bits of symbol value */
15#define R_MIPS_LO16 6 /* low 16 bits of symbol value */
16#define R_MIPS_GPREL16 7 /* GP-relative reference */
17#define R_MIPS_LITERAL 8 /* Reference to literal section */
18#define R_MIPS_GOT16 9 /* Reference to global offset table */
19#define R_MIPS_GOT R_MIPS_GOT16
20#define R_MIPS_PC16 10 /* 16 bit PC relative reference */
21#define R_MIPS_CALL16 11 /* 16 bit call thru glbl offset tbl */
22#define R_MIPS_CALL R_MIPS_CALL16
23#define R_MIPS_GPREL32 12
24
25/* 13, 14, 15 are not defined at this point. */
26#define R_MIPS_UNUSED1 13
27#define R_MIPS_UNUSED2 14
28#define R_MIPS_UNUSED3 15
29
30/*
31 * The remaining relocs are apparently part of the 64-bit Irix ELF ABI.
32 */
33#define R_MIPS_SHIFT5 16
34#define R_MIPS_SHIFT6 17
35
36#define R_MIPS_64 18
37#define R_MIPS_GOT_DISP 19
38#define R_MIPS_GOT_PAGE 20
39#define R_MIPS_GOT_OFST 21
40#define R_MIPS_GOT_HI16 22
41#define R_MIPS_GOT_LO16 23
42#define R_MIPS_SUB 24
43#define R_MIPS_INSERT_A 25
44#define R_MIPS_INSERT_B 26
45#define R_MIPS_DELETE 27
46#define R_MIPS_HIGHER 28
47#define R_MIPS_HIGHEST 29
48#define R_MIPS_CALL_HI16 30
49#define R_MIPS_CALL_LO16 31
50#define R_MIPS_SCN_DISP 32
51#define R_MIPS_REL16 33
52#define R_MIPS_ADD_IMMEDIATE 34
53#define R_MIPS_PJUMP 35
54#define R_MIPS_RELGOT 36
55#define R_MIPS_JALR 37
56/* TLS relocations */
57
58#define R_MIPS_TLS_DTPMOD32 38 /* Module number 32 bit */
59#define R_MIPS_TLS_DTPREL32 39 /* Module-relative offset 32 bit */
60#define R_MIPS_TLS_DTPMOD64 40 /* Module number 64 bit */
61#define R_MIPS_TLS_DTPREL64 41 /* Module-relative offset 64 bit */
62#define R_MIPS_TLS_GD 42 /* 16 bit GOT offset for GD */
63#define R_MIPS_TLS_LDM 43 /* 16 bit GOT offset for LDM */
64#define R_MIPS_TLS_DTPREL_HI16 44 /* Module-relative offset, high 16 bits */
65#define R_MIPS_TLS_DTPREL_LO16 45 /* Module-relative offset, low 16 bits */
66#define R_MIPS_TLS_GOTTPREL 46 /* 16 bit GOT offset for IE */
67#define R_MIPS_TLS_TPREL32 47 /* TP-relative offset, 32 bit */
68#define R_MIPS_TLS_TPREL64 48 /* TP-relative offset, 64 bit */
69#define R_MIPS_TLS_TPREL_HI16 49 /* TP-relative offset, high 16 bits */
70#define R_MIPS_TLS_TPREL_LO16 50 /* TP-relative offset, low 16 bits */
71
72#define R_MIPS_max 51
73
Elliott Hughesa6a3ac52013-01-29 15:02:50 -080074#define R_MIPS16_min 100
75#define R_MIPS16_26 100
76#define R_MIPS16_GPREL 101
77#define R_MIPS16_GOT16 102
78#define R_MIPS16_CALL16 103
79#define R_MIPS16_HI16 104
80#define R_MIPS16_LO16 105
81#define R_MIPS16_max 106
82
83
84/* mips dynamic tags */
85
86#define DT_MIPS_RLD_VERSION 0x70000001
87#define DT_MIPS_TIME_STAMP 0x70000002
88#define DT_MIPS_ICHECKSUM 0x70000003
89#define DT_MIPS_IVERSION 0x70000004
90#define DT_MIPS_FLAGS 0x70000005
91#define DT_MIPS_BASE_ADDRESS 0x70000006
92#define DT_MIPS_CONFLICT 0x70000008
93#define DT_MIPS_LIBLIST 0x70000009
94#define DT_MIPS_CONFLICTNO 0x7000000b
95#define DT_MIPS_LOCAL_GOTNO 0x7000000a /* number of local got ents */
96#define DT_MIPS_LIBLISTNO 0x70000010
97#define DT_MIPS_SYMTABNO 0x70000011 /* number of .dynsym entries */
98#define DT_MIPS_UNREFEXTNO 0x70000012
99#define DT_MIPS_GOTSYM 0x70000013 /* first dynamic sym in got */
100#define DT_MIPS_HIPAGENO 0x70000014
101#define DT_MIPS_RLD_MAP 0x70000016 /* address of loader map */
Lazar Trsic83b44a92016-04-06 13:39:17 +0200102#define DT_MIPS_RLD_MAP_REL 0x70000035 /* offset of loader map, used for PIE */
Elliott Hughesa6a3ac52013-01-29 15:02:50 -0800103
104/*
105 * ELF Flags
106 */
107#define EF_MIPS_PIC 0x00000002 /* Contains PIC code */
108#define EF_MIPS_CPIC 0x00000004 /* STD PIC calling sequence */
109#define EF_MIPS_ABI2 0x00000020 /* N32 */
110
111#define EF_MIPS_ARCH_ASE 0x0f000000 /* Architectural extensions */
112#define EF_MIPS_ARCH_MDMX 0x08000000 /* MDMX multimedia extension */
113#define EF_MIPS_ARCH_M16 0x04000000 /* MIPS-16 ISA extensions */
114
115#define EF_MIPS_ARCH 0xf0000000 /* Architecture field */
116#define EF_MIPS_ARCH_1 0x00000000 /* -mips1 code */
117#define EF_MIPS_ARCH_2 0x10000000 /* -mips2 code */
118#define EF_MIPS_ARCH_3 0x20000000 /* -mips3 code */
119#define EF_MIPS_ARCH_4 0x30000000 /* -mips4 code */
120#define EF_MIPS_ARCH_5 0x40000000 /* -mips5 code */
121#define EF_MIPS_ARCH_32 0x50000000 /* -mips32 code */
122#define EF_MIPS_ARCH_64 0x60000000 /* -mips64 code */
123#define EF_MIPS_ARCH_32R2 0x70000000 /* -mips32r2 code */
124#define EF_MIPS_ARCH_64R2 0x80000000 /* -mips64r2 code */
125
126#define EF_MIPS_ABI 0x0000f000
127#define EF_MIPS_ABI_O32 0x00001000
128#define EF_MIPS_ABI_O64 0x00002000
129#define EF_MIPS_ABI_EABI32 0x00003000
130#define EF_MIPS_ABI_EABI64 0x00004000
131
Elliott Hughesa6a3ac52013-01-29 15:02:50 -0800132#endif /* _MIPS_ELF_MACHDEP_H_ */