4d1898f44df36340facd6fd41469298ba1b31749
[external/binutils.git] / elfcpp / aarch64.h
1 // aarch64.h -- ELF definitions specific to AARCH64  -*- C++ -*-
2
3 // Copyright (C) 2014 Free Software Foundation, Inc.
4 // Written by Jing Yu (jingyu@google.com)
5
6 // This file is part of elfcpp.
7
8 // This program is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Library General Public License
10 // as published by the Free Software Foundation; either version 2, or
11 // (at your option) any later version.
12
13 // In addition to the permissions in the GNU Library General Public
14 // License, the Free Software Foundation gives you unlimited
15 // permission to link the compiled version of this file into
16 // combinations with other programs, and to distribute those
17 // combinations without any restriction coming from the use of this
18 // file.  (The Library Public License restrictions do apply in other
19 // respects; for example, they cover modification of the file, and
20 /// distribution when not linked into a combined executable.)
21
22 // This program is distributed in the hope that it will be useful, but
23 // WITHOUT ANY WARRANTY; without even the implied warranty of
24 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
25 // Library General Public License for more details.
26
27 // You should have received a copy of the GNU Library General Public
28 // License along with this program; if not, write to the Free Software
29 // Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
30 // 02110-1301, USA.
31
32 #ifndef ELFCPP_AARCH64_H
33 #define ELFCPP_AARCH64_H
34
35 namespace elfcpp
36 {
37
38 // The relocation type information is taken from:
39 //
40 //   ELF for the ARM 64-bit Architecture (AArch64)
41 //   Document number: ARM IHI 0056B, current through AArch64 ABI release 1.0
42 //   Date of Issue: 22nd May, 2013
43 //
44
45 enum
46 {
47   // Null relocation codes
48   R_AARCH64_NONE = 0,           // None
49   withdrawn = 256,              // Treat as R_AARCH64_NONE
50
51   // Static relocations
52   R_AARCH64_ABS64 = 257,        // S + A
53   R_AARCH64_ABS32 = 258,        // S + A
54   R_AARCH64_ABS16 = 259,        // S + A
55   R_AARCH64_PREL64 = 260,       // S + A - P
56   R_AARCH64_PREL32 = 261,       // S + A - P
57   R_AARCH64_PREL16 = 262,       // S + A - P
58   R_AARCH64_MOVW_UABS_G0 = 263,         // S + A
59   R_AARCH64_MOVW_UABS_G0_NC = 264,      // S + A
60   R_AARCH64_MOVW_UABS_G1 = 265,         // S + A
61   R_AARCH64_MOVW_UABS_G1_NC = 266,      // S + A
62   R_AARCH64_MOVW_UABS_G2 = 267,         // S + A
63   R_AARCH64_MOVW_UABS_G2_NC = 268,      // S + A
64   R_AARCH64_MOVW_UABS_G3 = 269,         // S + A
65   R_AARCH64_MOVW_SABS_G0 = 270,         // S + A
66   R_AARCH64_MOVW_SABS_G1 = 271,         // S + A
67   R_AARCH64_MOVW_SABS_G2 = 272,         // S + A
68   R_AARCH64_LD_PREL_LO19 = 273,         // S + A - P
69   R_AARCH64_ADR_PREL_LO21 = 274,        // S + A - P
70   R_AARCH64_ADR_PREL_PG_HI21 = 275,     // Page(S+A) - Page(P)
71   R_AARCH64_ADR_PREL_PG_HI21_NC = 276,  // Page(S+A) - Page(P)
72   R_AARCH64_ADD_ABS_LO12_NC = 277,      // S + A
73   R_AARCH64_LDST8_ABS_LO12_NC = 278,    // S + A
74   R_AARCH64_TSTBR14 = 279,              // S + A - P
75   R_AARCH64_CONDBR19 = 280,             // S + A - P
76   R_AARCH64_JUMP26 = 282,               // S + A - P
77   R_AARCH64_CALL26 = 283,               // S + A - P
78   R_AARCH64_LDST16_ABS_LO12_NC = 284,   // S + A
79   R_AARCH64_LDST32_ABS_LO12_NC = 285,   // S + A
80   R_AARCH64_LDST64_ABS_LO12_NC = 286,   // S + A
81   R_AARCH64_MOVW_PREL_G0 = 287,         // S + A - P
82   R_AARCH64_MOVW_PREL_G0_NC = 288,      // S + A - P
83   R_AARCH64_MOVW_PREL_G1 = 289,         // S + A - P
84   R_AARCH64_MOVW_PREL_G1_NC = 290,      // S + A - P
85   R_AARCH64_MOVW_PREL_G2 = 291,         // S + A - P
86   R_AARCH64_MOVW_PREL_G2_NC = 292,      // S + A - P
87   R_AARCH64_MOVW_PREL_G3 = 293,         // S + A - P
88   R_AARCH64_LDST128_ABS_LO12_NC = 299,  // S + A
89   R_AARCH64_MOVW_GOTOFF_G0 = 300,       // G(GDAT(S+A))-GOT
90   R_AARCH64_MOVW_GOTOFF_G0_NC = 301,    // G(GDAT(S+A))-GOT
91   R_AARCH64_MOVW_GOTOFF_G1 = 302,       // G(GDAT(S+A))-GOT
92   R_AARCH64_MOVW_GOTOFF_G1_NC = 303,    // G(GDAT(S+A))-GOT
93   R_AARCH64_MOVW_GOTOFF_G2 = 304,       // G(GDAT(S+A))-GOT
94   R_AARCH64_MOVW_GOTOFF_G2_NC = 305,    // G(GDAT(S+A))-GOT
95   R_AARCH64_MOVW_GOTOFF_G3 = 306,       // G(GDAT(S+A))-GOT
96   R_AARCH64_GOTREL64 = 307,             // S + A - GOT
97   R_AARCH64_GOTREL32 = 308,             // S + A - GOT
98   R_AARCH64_GOT_LD_PREL19 = 309,        // G(GDAT(S+A))-P
99   R_AARCH64_LD64_GOTOFF_LO15 = 310,     // G(GDAT(S+A))-GOT
100   R_AARCH64_ADR_GOT_PAGE = 311,         // Page(G(GDAT(S+A)))-Page(P)
101   R_AARCH64_LD64_GOT_LO12_NC = 312,     // G(GDAT(S+A))
102   R_AARCH64_LD64_GOTPAGE_LO15 = 313,    // G(GDAT(S+A))-Page(GOT)
103
104   // Relocations for thread-local storage
105   R_AARCH64_TLSGD_ADR_PREL21 = 512,             // G(GTLSIDX(S,A)) - P
106   R_AARCH64_TLSGD_ADR_PAGE21 = 513,             // Page(G(GTLSIDX(S,A)))-Page(P)
107   R_AARCH64_TLSGD_ADD_LO12_NC = 514,            // G(GTLSICX(S,A))
108   R_AARCH64_TLSGD_MOVW_G1 = 515,                // G(GTLSIDX(S,A)) - GOT
109   R_AARCH64_TLSGD_MOVW_G0_NC = 516,             // G(GTLSIDX(S,A)) - GOT
110
111   R_AARCH64_TLSLD_ADR_PREL21 = 517,             // G(GLDM(S)) - P
112   R_AARCH64_TLSLD_ADR_PAGE21 = 518,             // Page(G(GLDM(S))) - Page(P)
113   R_AARCH64_TLSLD_ADD_LO12_NC = 519,            // G(GLDM(S))
114   R_AARCH64_TLSLD_MOVW_G1 = 520,                // G(GLDM(S)) - GOT
115   R_AARCH64_TLSLD_MOVW_G0_NC = 521,             // G(GLDM(S)) - GOT
116   R_AARCH64_TLSLD_LD_PREL19 = 522,              // G(GLDM(S)) - P
117   R_AARCH64_TLSLD_MOVW_DTPREL_G2 = 523,         // DTPREL(S+A)
118   R_AARCH64_TLSLD_MOVW_DTPREL_G1 = 524,         // DTPREL(S+A)
119   R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC = 525,      // DTPREL(S+A)
120   R_AARCH64_TLSLD_MOVW_DTPREL_G0 = 526,         // DTPREL(S+A)
121   R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC = 527,      // DTPREL(S+A)
122   R_AARCH64_TLSLD_ADD_DTPREL_HI12 = 528,        // DTPREL(S+A)
123   R_AARCH64_TLSLD_ADD_DTPREL_LO12 = 529,        // DTPREL(S+A)
124   R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC = 530,     // DTPREL(S+A)
125   R_AARCH64_TLSLD_LDST8_DTPREL_LO12 = 531,      // DTPREL(S+A)
126   R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC = 532,   // DTPREL(S+A)
127   R_AARCH64_TLSLD_LDST16_DTPREL_LO12 = 533,     // DTPREL(S+A)
128   R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC = 534,  // DTPREL(S+A)
129   R_AARCH64_TLSLD_LDST32_DTPREL_LO12 = 535,     // DTPREL(S+A)
130   R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC = 536,  // DTPREL(S+A)
131   R_AARCH64_TLSLD_LDST64_DTPREL_LO12 = 537,     // DTPREL(S+A)
132   R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC = 538,  // DTPREL(S+A)
133   R_AARCH64_TLSIE_MOVW_GOTTPREL_G1 = 539,       // G(GTPREL(S+A)) - GOT
134   R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC = 540,    // G(GTPREL(S+A)) - GOT
135   R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 = 541,    // Page(G(GTPREL(S+A)))-Page(P)
136   R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC = 542,  // G(GTPREL(S+A))
137   R_AARCH64_TLSIE_LD_GOTTPREL_PREL19 = 543,     // G(GTPREL(S+A)) - P
138   R_AARCH64_TLSLE_MOVW_TPREL_G2 = 544,          // TPREL(S+A)
139   R_AARCH64_TLSLE_MOVW_TPREL_G1 = 545,          // TPREL(S+A)
140   R_AARCH64_TLSLE_MOVW_TPREL_G1_NC = 546,       // TPREL(S+A)
141   R_AARCH64_TLSLE_MOVW_TPREL_G0 = 547,          // TPREL(S+A)
142   R_AARCH64_TLSLE_MOVW_TPREL_G0_NC = 548,       // TPREL(S+A)
143   R_AARCH64_TLSLE_ADD_TPREL_HI12 = 549,         // TPREL(S+A)
144   R_AARCH64_TLSLE_ADD_TPREL_LO12 = 550,         // TPREL(S+A)
145   R_AARCH64_TLSLE_ADD_TPREL_LO12_NC = 551,      // TPREL(S+A)
146   R_AARCH64_TLSLE_LDST8_TPREL_LO12 = 552,       // TPREL(S+A)
147   R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC = 553,    // TPREL(S+A)
148   R_AARCH64_TLSLE_LDST16_TPREL_LO12 = 554,      // TPREL(S+A)
149   R_AARCH64_TLSLE_LSDT16_TPREL_LO12_NC = 555,   // TPREL(S+A)
150   R_AARCH64_TLSLE_LDST32_TPREL_LO12 = 556,      // TPREL(S+A)
151   R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC = 557,   // TPREL(S+A)
152   R_AARCH64_TLSLE_LDST64_TPREL_LO12 = 558,      // TPREL(S+A)
153   R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC = 559,   // TPREL(S+A)
154   R_AARCH64_TLSDESC_LD_PREL19 = 560,    // G(GTLSDESC(S+A)) - P
155   R_AARCH64_TLSDESC_ADR_PREL21 = 561,   // G(GTLSDESC(S+A)) - P
156   R_AARCH64_TLSDESC_ADR_PAGE21 = 562,   // Page(G(GTLSDESC(S+A)))-Page(P)
157   R_AARCH64_TLSDESC_LD64_LO12 = 563,    // G(GTLSDESC(S+A))
158   R_AARCH64_TLSDESC_ADD_LO12 = 564,     // G(GTLSDESC(S+A))
159   R_AARCH64_TLSDESC_OFF_G1 = 565,       // G(GTLSDESC(S+A)) - GOT
160   R_AARCH64_TLSDESC_OFF_G0_NC = 566,    // G(GTLSDESC(S+A)) - GOT
161   R_AARCH64_TLSDESC_LDR = 567,          // None
162   R_AARCH64_TLSDESC_ADD = 568,          // None
163   R_AARCH64_TLSDESC_CALL = 569,         // None
164   R_AARCH64_TLSLE_LDST128_TPREL_LO12 = 570,     // TPREL(S+A)
165   R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC = 571,  // TPREL(S+A)
166   R_AARCH64_TLSLD_LDST128_DTPREL_LO12 = 572,    // DTPREL(S+A)
167   R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC = 573, // DTPREL(S+A)
168
169   // Dynamic relocations
170   R_AARCH64_COPY = 1024,
171   R_AARCH64_GLOB_DAT = 1025,            // S + A
172   R_AARCH64_JUMP_SLOT = 1026,           // S + A
173   R_AARCH64_RELATIVE = 1027,            // Delta(S) + A
174   R_AARCH64_TLS_DTPREL64 = 1028,        // DTPREL(S+A)
175   R_AARCH64_TLS_DTPMOD64 = 1029,        // LDM(S)
176   R_AARCH64_TLS_TPREL64 = 1030,         // TPREL(S+A)
177   R_AARCH64_TLSDESC = 1031,             // TLSDESC(S+A)
178   R_AARCH64_IRELATIVE = 1032,           // Indirect(Delta(S) + A)
179 };
180
181 } // End namespace elfcpp.
182
183 #endif // !defined(ELFCPP_AARCH64_H)