1 /* PPC ELF support for BFD.
2 Copyright 1995, 1996, 1998, 2000, 2001 Free Software Foundation, Inc.
4 By Michael Meissner, Cygnus Support, <meissner@cygnus.com>, from information
5 in the System V Application Binary Interface, PowerPC Processor Supplement
6 and the PowerPC Embedded Application Binary Interface (eabi).
8 This file is part of BFD, the Binary File Descriptor library.
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
24 /* This file holds definitions specific to the PPC ELF ABI. Note
25 that most of this is not actually implemented by BFD. */
30 #include "elf/reloc-macros.h"
33 START_RELOC_NUMBERS (elf_ppc_reloc_type
)
34 RELOC_NUMBER (R_PPC_NONE
, 0)
35 RELOC_NUMBER (R_PPC_ADDR32
, 1)
36 RELOC_NUMBER (R_PPC_ADDR24
, 2)
37 RELOC_NUMBER (R_PPC_ADDR16
, 3)
38 RELOC_NUMBER (R_PPC_ADDR16_LO
, 4)
39 RELOC_NUMBER (R_PPC_ADDR16_HI
, 5)
40 RELOC_NUMBER (R_PPC_ADDR16_HA
, 6)
41 RELOC_NUMBER (R_PPC_ADDR14
, 7)
42 RELOC_NUMBER (R_PPC_ADDR14_BRTAKEN
, 8)
43 RELOC_NUMBER (R_PPC_ADDR14_BRNTAKEN
, 9)
44 RELOC_NUMBER (R_PPC_REL24
, 10)
45 RELOC_NUMBER (R_PPC_REL14
, 11)
46 RELOC_NUMBER (R_PPC_REL14_BRTAKEN
, 12)
47 RELOC_NUMBER (R_PPC_REL14_BRNTAKEN
, 13)
48 RELOC_NUMBER (R_PPC_GOT16
, 14)
49 RELOC_NUMBER (R_PPC_GOT16_LO
, 15)
50 RELOC_NUMBER (R_PPC_GOT16_HI
, 16)
51 RELOC_NUMBER (R_PPC_GOT16_HA
, 17)
52 RELOC_NUMBER (R_PPC_PLTREL24
, 18)
53 RELOC_NUMBER (R_PPC_COPY
, 19)
54 RELOC_NUMBER (R_PPC_GLOB_DAT
, 20)
55 RELOC_NUMBER (R_PPC_JMP_SLOT
, 21)
56 RELOC_NUMBER (R_PPC_RELATIVE
, 22)
57 RELOC_NUMBER (R_PPC_LOCAL24PC
, 23)
58 RELOC_NUMBER (R_PPC_UADDR32
, 24)
59 RELOC_NUMBER (R_PPC_UADDR16
, 25)
60 RELOC_NUMBER (R_PPC_REL32
, 26)
61 RELOC_NUMBER (R_PPC_PLT32
, 27)
62 RELOC_NUMBER (R_PPC_PLTREL32
, 28)
63 RELOC_NUMBER (R_PPC_PLT16_LO
, 29)
64 RELOC_NUMBER (R_PPC_PLT16_HI
, 30)
65 RELOC_NUMBER (R_PPC_PLT16_HA
, 31)
66 RELOC_NUMBER (R_PPC_SDAREL16
, 32)
67 RELOC_NUMBER (R_PPC_SECTOFF
, 33)
68 RELOC_NUMBER (R_PPC_SECTOFF_LO
, 34)
69 RELOC_NUMBER (R_PPC_SECTOFF_HI
, 35)
70 RELOC_NUMBER (R_PPC_SECTOFF_HA
, 36)
71 RELOC_NUMBER (R_PPC_ADDR30
, 37)
73 /* The following relocs are from the 64-bit PowerPC ELF ABI. */
74 RELOC_NUMBER (R_PPC64_ADDR64
, 38)
75 RELOC_NUMBER (R_PPC64_ADDR16_HIGHER
, 39)
76 RELOC_NUMBER (R_PPC64_ADDR16_HIGHERA
, 40)
77 RELOC_NUMBER (R_PPC64_ADDR16_HIGHEST
, 41)
78 RELOC_NUMBER (R_PPC64_ADDR16_HIGHESTA
, 42)
79 RELOC_NUMBER (R_PPC64_UADDR64
, 43)
80 RELOC_NUMBER (R_PPC64_REL64
, 44)
81 RELOC_NUMBER (R_PPC64_PLT64
, 45)
82 RELOC_NUMBER (R_PPC64_PLTREL64
, 46)
83 RELOC_NUMBER (R_PPC64_TOC16
, 47)
84 RELOC_NUMBER (R_PPC64_TOC16_LO
, 48)
85 RELOC_NUMBER (R_PPC64_TOC16_HI
, 49)
86 RELOC_NUMBER (R_PPC64_TOC16_HA
, 50)
87 RELOC_NUMBER (R_PPC64_TOC
, 51)
88 RELOC_NUMBER (R_PPC64_PLTGOT16
, 52)
89 RELOC_NUMBER (R_PPC64_PLTGOT16_LO
, 53)
90 RELOC_NUMBER (R_PPC64_PLTGOT16_HI
, 54)
91 RELOC_NUMBER (R_PPC64_PLTGOT16_HA
, 55)
93 /* The following relocs were added in the 64-bit PowerPC ELF ABI revision 1.2. */
94 RELOC_NUMBER (R_PPC64_ADDR16_DS
, 56)
95 RELOC_NUMBER (R_PPC64_ADDR16_LO_DS
, 57)
96 RELOC_NUMBER (R_PPC64_GOT16_DS
, 58)
97 RELOC_NUMBER (R_PPC64_GOT16_LO_DS
, 59)
98 RELOC_NUMBER (R_PPC64_PLT16_LO_DS
, 60)
99 RELOC_NUMBER (R_PPC64_SECTOFF_DS
, 61)
100 RELOC_NUMBER (R_PPC64_SECTOFF_LO_DS
, 62)
101 RELOC_NUMBER (R_PPC64_TOC16_DS
, 63)
102 RELOC_NUMBER (R_PPC64_TOC16_LO_DS
, 64)
103 RELOC_NUMBER (R_PPC64_PLTGOT16_DS
, 65)
104 RELOC_NUMBER (R_PPC64_PLTGOT16_LO_DS
, 66)
106 /* The remaining relocs are from the Embedded ELF ABI, and are not
107 in the SVR4 ELF ABI. */
108 RELOC_NUMBER (R_PPC_EMB_NADDR32
, 101)
109 RELOC_NUMBER (R_PPC_EMB_NADDR16
, 102)
110 RELOC_NUMBER (R_PPC_EMB_NADDR16_LO
, 103)
111 RELOC_NUMBER (R_PPC_EMB_NADDR16_HI
, 104)
112 RELOC_NUMBER (R_PPC_EMB_NADDR16_HA
, 105)
113 RELOC_NUMBER (R_PPC_EMB_SDAI16
, 106)
114 RELOC_NUMBER (R_PPC_EMB_SDA2I16
, 107)
115 RELOC_NUMBER (R_PPC_EMB_SDA2REL
, 108)
116 RELOC_NUMBER (R_PPC_EMB_SDA21
, 109)
117 RELOC_NUMBER (R_PPC_EMB_MRKREF
, 110)
118 RELOC_NUMBER (R_PPC_EMB_RELSEC16
, 111)
119 RELOC_NUMBER (R_PPC_EMB_RELST_LO
, 112)
120 RELOC_NUMBER (R_PPC_EMB_RELST_HI
, 113)
121 RELOC_NUMBER (R_PPC_EMB_RELST_HA
, 114)
122 RELOC_NUMBER (R_PPC_EMB_BIT_FLD
, 115)
123 RELOC_NUMBER (R_PPC_EMB_RELSDA
, 116)
125 /* These are GNU extensions to enable C++ vtable garbage collection. */
126 RELOC_NUMBER (R_PPC_GNU_VTINHERIT
, 253)
127 RELOC_NUMBER (R_PPC_GNU_VTENTRY
, 254)
129 /* This is a phony reloc to handle any old fashioned TOC16 references
130 that may still be in object files. */
131 RELOC_NUMBER (R_PPC_TOC16
, 255)
133 END_RELOC_NUMBERS (R_PPC_max
)
135 /* Aliases for R_PPC64-relocs. */
136 #define R_PPC64_NONE R_PPC_NONE
137 #define R_PPC64_ADDR32 R_PPC_ADDR32
138 #define R_PPC64_ADDR24 R_PPC_ADDR24
139 #define R_PPC64_ADDR16 R_PPC_ADDR16
140 #define R_PPC64_ADDR16_LO R_PPC_ADDR16_LO
141 #define R_PPC64_ADDR16_HI R_PPC_ADDR16_HI
142 #define R_PPC64_ADDR16_HA R_PPC_ADDR16_HA
143 #define R_PPC64_ADDR14 R_PPC_ADDR14
144 #define R_PPC64_ADDR14_BRTAKEN R_PPC_ADDR14_BRTAKEN
145 #define R_PPC64_ADDR14_BRNTAKEN R_PPC_ADDR14_BRNTAKEN
146 #define R_PPC64_REL24 R_PPC_REL24
147 #define R_PPC64_REL14 R_PPC_REL14
148 #define R_PPC64_REL14_BRTAKEN R_PPC_REL14_BRTAKEN
149 #define R_PPC64_REL14_BRNTAKEN R_PPC_REL14_BRNTAKEN
150 #define R_PPC64_GOT16 R_PPC_GOT16
151 #define R_PPC64_GOT16_LO R_PPC_GOT16_LO
152 #define R_PPC64_GOT16_HI R_PPC_GOT16_HI
153 #define R_PPC64_GOT16_HA R_PPC_GOT16_HA
154 #define R_PPC64_COPY R_PPC_COPY
155 #define R_PPC64_GLOB_DAT R_PPC_GLOB_DAT
156 #define R_PPC64_JMP_SLOT R_PPC_JMP_SLOT
157 #define R_PPC64_RELATIVE R_PPC_RELATIVE
158 #define R_PPC64_UADDR32 R_PPC_UADDR32
159 #define R_PPC64_UADDR16 R_PPC_UADDR16
160 #define R_PPC64_REL32 R_PPC_REL32
161 #define R_PPC64_PLT32 R_PPC_PLT32
162 #define R_PPC64_PLTREL32 R_PPC_PLTREL32
163 #define R_PPC64_PLT16_LO R_PPC_PLT16_LO
164 #define R_PPC64_PLT16_HI R_PPC_PLT16_HI
165 #define R_PPC64_PLT16_HA R_PPC_PLT16_HA
166 #define R_PPC64_SECTOFF R_PPC_SECTOFF
167 #define R_PPC64_SECTOFF_LO R_PPC_SECTOFF_LO
168 #define R_PPC64_SECTOFF_HI R_PPC_SECTOFF_HI
169 #define R_PPC64_SECTOFF_HA R_PPC_SECTOFF_HA
170 #define R_PPC64_ADDR30 R_PPC_ADDR30
171 #define R_PPC64_GNU_VTINHERIT R_PPC_GNU_VTINHERIT
172 #define R_PPC64_GNU_VTENTRY R_PPC_GNU_VTENTRY
174 /* Processor specific flags for the ELF header e_flags field. */
176 #define EF_PPC_EMB 0x80000000 /* PowerPC embedded flag. */
178 #define EF_PPC_RELOCATABLE 0x00010000 /* PowerPC -mrelocatable flag. */
179 #define EF_PPC_RELOCATABLE_LIB 0x00008000 /* PowerPC -mrelocatable-lib flag. */
181 /* Processor specific section headers, sh_type field. */
183 #define SHT_ORDERED SHT_HIPROC /* Link editor is to sort the \
184 entries in this section \
185 based on the address \
186 specified in the associated \
187 symbol table entry. */
189 /* Processor specific section flags, sh_flags field. */
191 #define SHF_EXCLUDE 0x80000000 /* Link editor is to exclude \
192 this section from executable \
193 and shared objects that it \
194 builds when those objects \
195 are not to be furhter \
197 #endif /* _ELF_PPC_H */