@@ -27,18 +27,14 @@ using namespace llvm;
27
27
28
28
namespace {
29
29
class ARMMachObjectWriter : public MCMachObjectTargetWriter {
30
- void RecordARMScatteredRelocation (MachObjectWriter *Writer,
30
+ void recordARMScatteredRelocation (MachObjectWriter *Writer,
31
31
const MCAssembler &Asm,
32
- const MCAsmLayout &Layout,
33
32
const MCFragment *Fragment,
34
- const MCFixup &Fixup,
35
- MCValue Target,
36
- unsigned Type,
37
- unsigned Log2Size,
33
+ const MCFixup &Fixup, MCValue Target,
34
+ unsigned Type, unsigned Log2Size,
38
35
uint64_t &FixedValue);
39
- void RecordARMScatteredHalfRelocation (MachObjectWriter *Writer,
36
+ void recordARMScatteredHalfRelocation (MachObjectWriter *Writer,
40
37
const MCAssembler &Asm,
41
- const MCAsmLayout &Layout,
42
38
const MCFragment *Fragment,
43
39
const MCFixup &Fixup, MCValue Target,
44
40
uint64_t &FixedValue);
@@ -53,9 +49,8 @@ class ARMMachObjectWriter : public MCMachObjectTargetWriter {
53
49
: MCMachObjectTargetWriter(Is64Bit, CPUType, CPUSubtype) {}
54
50
55
51
void recordRelocation (MachObjectWriter *Writer, MCAssembler &Asm,
56
- const MCAsmLayout &Layout, const MCFragment *Fragment,
57
- const MCFixup &Fixup, MCValue Target,
58
- uint64_t &FixedValue) override ;
52
+ const MCFragment *Fragment, const MCFixup &Fixup,
53
+ MCValue Target, uint64_t &FixedValue) override ;
59
54
};
60
55
}
61
56
@@ -136,15 +131,11 @@ static bool getARMFixupKindMachOInfo(unsigned Kind, unsigned &RelocType,
136
131
}
137
132
}
138
133
139
- void ARMMachObjectWriter::
140
- RecordARMScatteredHalfRelocation (MachObjectWriter *Writer,
141
- const MCAssembler &Asm,
142
- const MCAsmLayout &Layout,
143
- const MCFragment *Fragment,
144
- const MCFixup &Fixup,
145
- MCValue Target,
146
- uint64_t &FixedValue) {
147
- uint32_t FixupOffset = Layout.getFragmentOffset (Fragment)+Fixup.getOffset ();
134
+ void ARMMachObjectWriter::recordARMScatteredHalfRelocation (
135
+ MachObjectWriter *Writer, const MCAssembler &Asm,
136
+ const MCFragment *Fragment, const MCFixup &Fixup, MCValue Target,
137
+ uint64_t &FixedValue) {
138
+ uint32_t FixupOffset = Asm.getFragmentOffset (*Fragment) + Fixup.getOffset ();
148
139
149
140
if (FixupOffset & 0xff000000 ) {
150
141
Asm.getContext ().reportError (Fixup.getLoc (),
@@ -167,7 +158,7 @@ RecordARMScatteredHalfRelocation(MachObjectWriter *Writer,
167
158
return ;
168
159
}
169
160
170
- uint32_t Value = Writer->getSymbolAddress (*A, Layout );
161
+ uint32_t Value = Writer->getSymbolAddress (*A, *Asm. getLayout () );
171
162
uint32_t Value2 = 0 ;
172
163
uint64_t SecAddr = Writer->getSectionAddress (A->getFragment ()->getParent ());
173
164
FixedValue += SecAddr;
@@ -184,7 +175,7 @@ RecordARMScatteredHalfRelocation(MachObjectWriter *Writer,
184
175
185
176
// Select the appropriate difference relocation type.
186
177
Type = MachO::ARM_RELOC_HALF_SECTDIFF;
187
- Value2 = Writer->getSymbolAddress (B->getSymbol (), Layout );
178
+ Value2 = Writer->getSymbolAddress (B->getSymbol (), *Asm. getLayout () );
188
179
FixedValue -= Writer->getSectionAddress (SB->getFragment ()->getParent ());
189
180
}
190
181
@@ -250,16 +241,11 @@ RecordARMScatteredHalfRelocation(MachObjectWriter *Writer,
250
241
Writer->addRelocation (nullptr , Fragment->getParent (), MRE);
251
242
}
252
243
253
- void ARMMachObjectWriter::RecordARMScatteredRelocation (MachObjectWriter *Writer,
254
- const MCAssembler &Asm,
255
- const MCAsmLayout &Layout,
256
- const MCFragment *Fragment,
257
- const MCFixup &Fixup,
258
- MCValue Target,
259
- unsigned Type,
260
- unsigned Log2Size,
261
- uint64_t &FixedValue) {
262
- uint32_t FixupOffset = Layout.getFragmentOffset (Fragment)+Fixup.getOffset ();
244
+ void ARMMachObjectWriter::recordARMScatteredRelocation (
245
+ MachObjectWriter *Writer, const MCAssembler &Asm,
246
+ const MCFragment *Fragment, const MCFixup &Fixup, MCValue Target,
247
+ unsigned Type, unsigned Log2Size, uint64_t &FixedValue) {
248
+ uint32_t FixupOffset = Asm.getFragmentOffset (*Fragment) + Fixup.getOffset ();
263
249
264
250
if (FixupOffset & 0xff000000 ) {
265
251
Asm.getContext ().reportError (Fixup.getLoc (),
@@ -281,7 +267,7 @@ void ARMMachObjectWriter::RecordARMScatteredRelocation(MachObjectWriter *Writer,
281
267
return ;
282
268
}
283
269
284
- uint32_t Value = Writer->getSymbolAddress (*A, Layout );
270
+ uint32_t Value = Writer->getSymbolAddress (*A, *Asm. getLayout () );
285
271
uint64_t SecAddr = Writer->getSectionAddress (A->getFragment ()->getParent ());
286
272
FixedValue += SecAddr;
287
273
uint32_t Value2 = 0 ;
@@ -299,7 +285,7 @@ void ARMMachObjectWriter::RecordARMScatteredRelocation(MachObjectWriter *Writer,
299
285
300
286
// Select the appropriate difference relocation type.
301
287
Type = MachO::ARM_RELOC_SECTDIFF;
302
- Value2 = Writer->getSymbolAddress (B->getSymbol (), Layout );
288
+ Value2 = Writer->getSymbolAddress (B->getSymbol (), *Asm. getLayout () );
303
289
FixedValue -= Writer->getSectionAddress (SB->getFragment ()->getParent ());
304
290
}
305
291
@@ -374,7 +360,6 @@ bool ARMMachObjectWriter::requiresExternRelocation(MachObjectWriter *Writer,
374
360
375
361
void ARMMachObjectWriter::recordRelocation (MachObjectWriter *Writer,
376
362
MCAssembler &Asm,
377
- const MCAsmLayout &Layout,
378
363
const MCFragment *Fragment,
379
364
const MCFixup &Fixup, MCValue Target,
380
365
uint64_t &FixedValue) {
@@ -395,11 +380,10 @@ void ARMMachObjectWriter::recordRelocation(MachObjectWriter *Writer,
395
380
// relocations.
396
381
if (Target.getSymB ()) {
397
382
if (RelocType == MachO::ARM_RELOC_HALF)
398
- return RecordARMScatteredHalfRelocation (Writer, Asm, Layout, Fragment,
399
- Fixup, Target, FixedValue);
400
- return RecordARMScatteredRelocation (Writer, Asm, Layout, Fragment, Fixup,
401
- Target, RelocType, Log2Size,
402
- FixedValue);
383
+ return recordARMScatteredHalfRelocation (Writer, Asm, Fragment, Fixup,
384
+ Target, FixedValue);
385
+ return recordARMScatteredRelocation (Writer, Asm, Fragment, Fixup, Target,
386
+ RelocType, Log2Size, FixedValue);
403
387
}
404
388
405
389
// Get the symbol data, if any.
@@ -417,12 +401,11 @@ void ARMMachObjectWriter::recordRelocation(MachObjectWriter *Writer,
417
401
Offset += 1 << Log2Size;
418
402
if (Offset && A && !Writer->doesSymbolRequireExternRelocation (*A) &&
419
403
RelocType != MachO::ARM_RELOC_HALF)
420
- return RecordARMScatteredRelocation (Writer, Asm, Layout, Fragment, Fixup,
421
- Target, RelocType, Log2Size,
422
- FixedValue);
404
+ return recordARMScatteredRelocation (Writer, Asm, Fragment, Fixup, Target,
405
+ RelocType, Log2Size, FixedValue);
423
406
424
407
// See <reloc.h>.
425
- uint32_t FixupOffset = Layout .getFragmentOffset (Fragment)+ Fixup.getOffset ();
408
+ uint32_t FixupOffset = Asm .getFragmentOffset (* Fragment) + Fixup.getOffset ();
426
409
unsigned Index = 0 ;
427
410
unsigned Type = 0 ;
428
411
const MCSymbol *RelSymbol = nullptr ;
@@ -453,7 +436,7 @@ void ARMMachObjectWriter::recordRelocation(MachObjectWriter *Writer,
453
436
// compensate for the addend of the symbol address, if it was
454
437
// undefined. This occurs with weak definitions, for example.
455
438
if (!A->isUndefined ())
456
- FixedValue -= Layout .getSymbolOffset (*A);
439
+ FixedValue -= Asm .getSymbolOffset (*A);
457
440
} else {
458
441
// The index is the section ordinal (1-based).
459
442
const MCSection &Sec = A->getSection ();
0 commit comments