-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrelocations
319 lines (254 loc) · 9.26 KB
/
relocations
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
Relocations.
------------
Xtensa uses RELA relocations:
typedef struct {
Elf32_Addr r_offset;
uint32_t r_info;
int32_t r_addend;
} Elf32_Rela;
r_offset This member gives the location at which to apply the
relocation action. For a relocatable file, the value is
the byte offset from the beginning of the section to the
storage unit affected by the relocation. For an executable
file or shared object, the value is the virtual address of
the storage unit affected by the relocation.
r_info This member gives both the symbol table index with respect
to which the relocation must be made and the type of
relocation to apply. Relocation types are processor-
specific. When the text refers to a relocation entry's
relocation type or symbol table index, it means the result
of applying ELF32_R_TYPE (LSB) or ELF32_R_SYM (3 MSB),
respectively, to the entry's r_info member.
r_addend This member specifies a constant addend used to compute the
value to be stored into the relocatable field.
Xtensa TLS descriptor structures:
typedef struct dl_tls_index
{
unsigned long int ti_module;
unsigned long int ti_offset;
} tls_index;
ti_module Internal index of the module containing TLS variable used by
the dynamic linker. This index is used to access DTV array.
ti_offset Offset of the variable inside module's TLS area.
struct tlsdesc_dynamic_arg
{
tls_index tlsinfo;
size_t gen_count;
};
Relocation calculation symbols:
A Addend encoded in the relocation.
S Address of a symbol referred to by relocation.
T Module's offset in the static TLS block.
v Value at location being relocated.
Xtensa relocation types:
Name: R_XTENSA_NONE
Meaning: Placeholder, no actual relocation.
Generated by: Linker.
Reloc type: N/A
ELF types: REL, DYN, EXEC
Sections: .rela.*
Calculation: N/A
Name: R_XTENSA_32
Meaning: Reference to a symbol.
For local symbols, symbol referred to is of the section that
contains target symbol.
It turns into R_XTENSA_GLOB_DAT in DYN and EXEC when linked
against dynamic symbol.
It turns into R_XTENSA_RELATIVE when linked statically.
Generated by: Assembler.
Reloc type: Partial in place.
Both the value of the field being relocated and addend may be
non-zero. For historical reasons, BFD mention issues with
DWARF after partial linking.
ELF types: REL
Sections: .rela.<referenced section name>
Calculation: S + A + v
Name: R_XTENSA_RTLD
Meaning: Special relocations for runtime linker. Runtime linker replaces
data pointed to by relocation with r_addend == 1 with a pointer
to runtime linker dynamic resolver function, and data pointed
to by relocation with r_addend == 2 with a pointer to the link
map for the shared object. R_XTENSA_RTLD point to two words at
the beginning of each .got.plt chunk. PLT entry code calls
runtime linker dynamic resolver function with two arguments:
pointer to the link map for the shared object and relocation
index.
Generated by: Linker.
Reloc type: Custom.
ELF types: DYN, EXEC
Sections: .rela.dyn
Calculation: Filled in by dynamic linker.
Name: R_XTENSA_GLOB_DAT
Meaning: Reference to a dynamic symbol.
Generated by: Linker.
Reloc type: True RELA.
ELF types: DYN, EXEC
Sections: .rela.dyn
Calculation: S + A
Name: R_XTENSA_JMP_SLOT
Meaning: Reference to a dynamic function-type symbol.
Generated by: Linker.
Reloc type: True RELA.
ELF types: DYN, EXEC
Sections: .rela.plt
Calculation: S + A
Name: R_XTENSA_RELATIVE
Meaning: Reference to a location in the same object.
Generated by: Linker.
Reloc type: Partial in place, not marked as such in BFD.
ELF types: DYN, EXEC
Sections: .rela.dyn
Calculation: v
Name: R_XTENSA_PLT
Meaning: Reference to a symbol, for which the linker will have to
create PLT entry.
It turns into R_XTENSA_JMP_SLOT in .rela.plt in DYN and EXEC.
Generated by: Assembler. @plt suffix.
Reloc type: True RELA.
ELF types: REL
Sections: .rela.<referenced section name>
Calculation: S + A
Name: R_XTENSA_OP{0..2}
Meaning:
ELF types:
Calculation:
Name: R_XTENSA_ASM_EXPAND
Meaning:
ELF types:
Calculation:
Name: R_XTENSA_ASM_SIMPLIFY
Meaning:
ELF types:
Calculation:
Name: R_XTENSA_32_PCREL
Meaning: PC-relative reference to a local symbol. May not be used with
code, only with data. Gets resolved and disappears completely
after final linking.
Used to prepare data for exception handling code.
Generated by: Assembler. @pcrel suffix.
Reloc type: True RELA.
ELF types: REL
Sections: .rela.<referenced section name>
Calculation: S + A - PC
Name: R_XTENSA_GNU_VTINHERIT
Meaning:
ELF types:
Calculation:
Name: R_XTENSA_GNU_VTENTRY
Meaning:
ELF types:
Calculation:
Name: R_XTENSA_DIFF8
Name: R_XTENSA_DIFF16
Name: R_XTENSA_DIFF32
Meaning: 1-, 2- or 4-byte signed difference between two defined
locations in the same section. Only kept for relaxation, may
be ignored when relaxation is not performed.
Generated by: Assembler.
Reloc type: This relocation type is deprecated because its semantic is
inconsistent: it cannot support both unsigned and signed 8-
and 16-bit values, resulting in linking errors. It is no
longer generated by assembler, but still supported by linker
with the existing semantic.
Partial in place, not marked as such in BFD.
The value of the field being relocated is the current
difference. S + A points to the subtrahend. If minuend is a
global symbol S points to it, otherwise it points to the
containing section.
ELF types: REL
Sections: .rela.<referenced section name>
Calculation: v(relaxed) = (S + A + v(sign extended))(relaxed) - (S + A)(relaxed)
Name: R_XTENSA_SLOT{0..14}_OP
Meaning:
ELF types:
Calculation:
Name: R_XTENSA_SLOT{0..14}_ALT
Meaning:
ELF types:
Calculation:
Name: R_XTENSA_TLSDESC_FN
Meaning: Reference to a __tls_get_addr-like function. Function is
chosen by the dynamic linker depending on whether the space for
module's TLS variables was allocated statically or dynamically.
Generated by: Assembler. @tlsfunc suffix mentioned in movi relaxed to l32r.
Reloc type: Custom.
ELF types: REL, DYN, EXEC
Sections: .rela.<referenced section name>, .rela.dyn
Calculation: Filled in by dynamic linker.
Name: R_XTENSA_TLSDESC_ARG
Meaning: Reference to a __tls_get_addr-like function argument. The
argument may be a TLS variable descriptor pointer or an offset
inside the static TLS allocation. Dynamic linker has to make
it match the type of the __tls_get_addr-like function in the
corresponding R_XTENSA_TLSDESC_FN relocation.
See Xtensa TLS descriptor structures above.
Generated by: Assembler. @tlsarg suffix mentioned in movi relaxed to l32r.
Reloc type: True RELA.
ELF types: REL, DYN, EXEC
Sections: .rela.<referenced section name>, .rela.dyn
Calculation: S + A or S + A + T
Name: R_XTENSA_TLS_DTPOFF
Meaning: TLS variable offset relative to its module's TLS variable
block. It either disappears when linking into DYN, or turns
into R_XTENSA_TLS_TPOFF when linking into EXEC.
Generated by: Assembler. @dtpoff suffix mentioned in movi relaxed to l32r.
ELF types: REL
Calculation:
Name: R_XTENSA_TLS_TPOFF
Meaning: TLS variable offset relative to the TLS pointer.
Generated by: Assembler or linker. @tpoff suffix mentioned in movi relaxed
to l32r.
Reloc type: True RELA.
ELF types: REL, EXEC
Sections: .rela.<referenced section name>, .rela.dyn
Calculation: S + A + T
Name: R_XTENSA_TLS_FUNC
Meaning: Opcode loading __tls_get_addr-like function address into
register.
It is used for link-time relaxation only.
Generated by: Assembler. @tlsfunc suffix mentioned in movi relaxed to l32r.
ELF types: REL
Calculation:
Name: R_XTENSA_TLS_ARG
Meaning: Opcode loading __tls_get_addr-like function parameter (TLS
variable index pointer) into register.
It is used for link-time relaxation only.
Generated by: Assembler. @tlsarg suffix mentioned in movi relaxed to l32r.
ELF types: REL
Calculation:
Name: R_XTENSA_TLS_CALL
Meaning: __tls_get_addr-like function call.
It is used for link-time relaxation only.
Generated by: Assembler. @tlscall suffix to additional call*.tls argument.
ELF types: REL
Calculation:
Name: R_XTENSA_PDIFF8
Name: R_XTENSA_PDIFF16
Name: R_XTENSA_PDIFF32
Meaning: 1-, 2- or 4-byte unsigned positive difference between two
defined locations in the same section. Only kept for
relaxation, may be ignored when relaxation is not performed.
Generated by: Assembler.
Reloc type: Partial in place, not marked as such in BFD.
The value of the field being relocated is the current
difference. S + A points to the subtrahend. If minuend is a
global symbol S points to it, otherwise it points to the
containing section.
ELF types: REL
Sections: .rela.<referenced section name>
Calculation: v(relaxed) = (S + A + v(zero extended))(relaxed) - (S + A)(relaxed)
Name: R_XTENSA_NDIFF8
Name: R_XTENSA_NDIFF16
Name: R_XTENSA_NDIFF32
Meaning: 1-, 2- or 4-byte unsigned negative difference between two
defined locations in the same section. Only kept for
relaxation, may be ignored when relaxation is not performed.
Generated by: Assembler.
Reloc type: Partial in place, not marked as such in BFD.
The value of the field being relocated is the current
difference. S + A points to the subtrahend. If minuend is a
global symbol S points to it, otherwise it points to the
containing section.
ELF types: REL
Sections: .rela.<referenced section name>
Calculation: v(relaxed) = (S + A + v(one extended))(relaxed) - (S + A)(relaxed)