@@ -81,13 +81,13 @@ uint32_t ARM::calcEFlags() const {
81
81
// with BE-8 code.
82
82
uint32_t armBE8 = 0 ;
83
83
84
- if (config-> armVFPArgs == ARMVFPArgKind::Base ||
85
- config-> armVFPArgs == ARMVFPArgKind::Default)
84
+ if (ctx. arg . armVFPArgs == ARMVFPArgKind::Base ||
85
+ ctx. arg . armVFPArgs == ARMVFPArgKind::Default)
86
86
abiFloatType = EF_ARM_ABI_FLOAT_SOFT;
87
- else if (config-> armVFPArgs == ARMVFPArgKind::VFP)
87
+ else if (ctx. arg . armVFPArgs == ARMVFPArgKind::VFP)
88
88
abiFloatType = EF_ARM_ABI_FLOAT_HARD;
89
89
90
- if (!config-> isLE && config-> armBe8 )
90
+ if (!ctx. arg . isLE && ctx. arg . armBe8 )
91
91
armBE8 = EF_ARM_BE8;
92
92
93
93
// We don't currently use any features incompatible with EF_ARM_EABI_VER5,
@@ -134,11 +134,11 @@ RelExpr ARM::getRelExpr(RelType type, const Symbol &s,
134
134
case R_ARM_SBREL32:
135
135
return R_ARM_SBREL;
136
136
case R_ARM_TARGET1:
137
- return config-> target1Rel ? R_PC : R_ABS;
137
+ return ctx. arg . target1Rel ? R_PC : R_ABS;
138
138
case R_ARM_TARGET2:
139
- if (config-> target2 == Target2Policy::Rel)
139
+ if (ctx. arg . target2 == Target2Policy::Rel)
140
140
return R_PC;
141
- if (config-> target2 == Target2Policy::Abs)
141
+ if (ctx. arg . target2 == Target2Policy::Abs)
142
142
return R_ABS;
143
143
return R_GOT_PC;
144
144
case R_ARM_TLS_GD32:
@@ -198,7 +198,7 @@ RelExpr ARM::getRelExpr(RelType type, const Symbol &s,
198
198
}
199
199
200
200
RelType ARM::getDynRel (RelType type) const {
201
- if ((type == R_ARM_ABS32) || (type == R_ARM_TARGET1 && !config-> target1Rel ))
201
+ if ((type == R_ARM_ABS32) || (type == R_ARM_TARGET1 && !ctx. arg . target1Rel ))
202
202
return R_ARM_ABS32;
203
203
return R_ARM_NONE;
204
204
}
@@ -231,7 +231,7 @@ static void writePltHeaderLong(uint8_t *buf) {
231
231
// True if we should use Thumb PLTs, which currently require Thumb2, and are
232
232
// only used if the target does not have the ARM ISA.
233
233
static bool useThumbPLTs () {
234
- return config-> armHasThumb2ISA && !config-> armHasArmISA ;
234
+ return ctx. arg . armHasThumb2ISA && !ctx. arg . armHasArmISA ;
235
235
}
236
236
237
237
// The default PLT header requires the .got.plt to be within 128 Mb of the
@@ -407,7 +407,7 @@ bool ARM::needsThunk(RelExpr expr, RelType type, const InputFile *file,
407
407
case R_ARM_CALL: {
408
408
uint64_t dst = (expr == R_PLT_PC) ? s.getPltVA () : s.getVA ();
409
409
return !inBranchRange (type, branchAddr, dst + a) ||
410
- (!config-> armHasBlx && (s.getVA () & 1 ));
410
+ (!ctx. arg . armHasBlx && (s.getVA () & 1 ));
411
411
}
412
412
case R_ARM_THM_JUMP19:
413
413
case R_ARM_THM_JUMP24:
@@ -420,7 +420,7 @@ bool ARM::needsThunk(RelExpr expr, RelType type, const InputFile *file,
420
420
case R_ARM_THM_CALL: {
421
421
uint64_t dst = (expr == R_PLT_PC) ? s.getPltVA () : s.getVA ();
422
422
return !inBranchRange (type, branchAddr, dst + a) ||
423
- (!config-> armHasBlx && (s.getVA () & 1 ) == 0 );;
423
+ (!ctx. arg . armHasBlx && (s.getVA () & 1 ) == 0 );;
424
424
}
425
425
}
426
426
return false ;
@@ -456,7 +456,7 @@ uint32_t ARM::getThunkSectionSpacing() const {
456
456
// range. On earlier Architectures such as ARMv4, ARMv5 and ARMv6 (except
457
457
// ARMv6T2) the range is +/- 4MiB.
458
458
459
- return (config-> armJ1J2BranchEncoding ) ? 0x1000000 - 0x30000
459
+ return (ctx. arg . armJ1J2BranchEncoding ) ? 0x1000000 - 0x30000
460
460
: 0x400000 - 0x7500 ;
461
461
}
462
462
@@ -481,7 +481,7 @@ bool ARM::inBranchRange(RelType type, uint64_t src, uint64_t dst) const {
481
481
return llvm::isInt<21 >(offset);
482
482
case R_ARM_THM_JUMP24:
483
483
case R_ARM_THM_CALL:
484
- return config-> armJ1J2BranchEncoding ? llvm::isInt<25 >(offset)
484
+ return ctx. arg . armJ1J2BranchEncoding ? llvm::isInt<25 >(offset)
485
485
: llvm::isInt<23 >(offset);
486
486
default :
487
487
return true ;
@@ -697,7 +697,7 @@ void ARM::relocate(uint8_t *loc, const Relocation &rel, uint64_t val) const {
697
697
} else {
698
698
write16 (loc + 2 , (read16 (loc + 2 ) & ~0x1000 ) | 1 << 12 );
699
699
}
700
- if (!config-> armJ1J2BranchEncoding ) {
700
+ if (!ctx. arg . armJ1J2BranchEncoding ) {
701
701
// Older Arm architectures do not support R_ARM_THM_JUMP24 and have
702
702
// different encoding rules and range due to J1 and J2 always being 1.
703
703
checkInt (loc, val, 23 , rel);
@@ -909,7 +909,7 @@ int64_t ARM::getImplicitAddend(const uint8_t *buf, RelType type) const {
909
909
((lo & 0x07ff ) << 1 )); // imm11:0
910
910
}
911
911
case R_ARM_THM_CALL:
912
- if (!config-> armJ1J2BranchEncoding ) {
912
+ if (!ctx. arg . armJ1J2BranchEncoding ) {
913
913
// Older Arm architectures do not support R_ARM_THM_JUMP24 and have
914
914
// different encoding rules and range due to J1 and J2 always being 1.
915
915
uint16_t hi = read16 (buf);
@@ -1261,7 +1261,7 @@ static std::string checkCmseSymAttributes(Symbol *acleSeSym, Symbol *sym) {
1261
1261
// Both these symbols are Thumb function symbols with external linkage.
1262
1262
// <sym> may be redefined in .gnu.sgstubs.
1263
1263
void elf::processArmCmseSymbols () {
1264
- if (!config-> cmseImplib )
1264
+ if (!ctx. arg . cmseImplib )
1265
1265
return ;
1266
1266
// Only symbols with external linkage end up in symtab, so no need to do
1267
1267
// linkage checks. Only check symbol type.
@@ -1270,9 +1270,9 @@ void elf::processArmCmseSymbols() {
1270
1270
continue ;
1271
1271
// If input object build attributes do not support CMSE, error and disable
1272
1272
// further scanning for <sym>, __acle_se_<sym> pairs.
1273
- if (!config-> armCMSESupport ) {
1273
+ if (!ctx. arg . armCMSESupport ) {
1274
1274
error (" CMSE is only supported by ARMv8-M architecture or later" );
1275
- config-> cmseImplib = false ;
1275
+ ctx. arg . cmseImplib = false ;
1276
1276
break ;
1277
1277
}
1278
1278
@@ -1348,7 +1348,7 @@ ArmCmseSGSection::ArmCmseSGSection()
1348
1348
" ' from CMSE import library is not present in secure application" );
1349
1349
}
1350
1350
1351
- if (!symtab.cmseImportLib .empty () && config-> cmseOutputLib .empty ()) {
1351
+ if (!symtab.cmseImportLib .empty () && ctx. arg . cmseOutputLib .empty ()) {
1352
1352
for (auto &[_, entryFunc] : symtab.cmseSymMap ) {
1353
1353
Symbol *sym = entryFunc.sym ;
1354
1354
if (!symtab.inCMSEOutImpLib .count (sym->getName ()))
@@ -1476,17 +1476,17 @@ template <typename ELFT> void elf::writeARMCmseImportLib() {
1476
1476
off = osec->offset + osec->size ;
1477
1477
}
1478
1478
1479
- const uint64_t sectionHeaderOff = alignToPowerOf2 (off, config-> wordsize );
1479
+ const uint64_t sectionHeaderOff = alignToPowerOf2 (off, ctx. arg . wordsize );
1480
1480
const auto shnum = osIsPairs.size () + 1 ;
1481
1481
const uint64_t fileSize =
1482
1482
sectionHeaderOff + shnum * sizeof (typename ELFT::Shdr);
1483
1483
const unsigned flags =
1484
- config-> mmapOutputFile ? 0 : (unsigned )FileOutputBuffer::F_no_mmap;
1485
- unlinkAsync (config-> cmseOutputLib );
1484
+ ctx. arg . mmapOutputFile ? 0 : (unsigned )FileOutputBuffer::F_no_mmap;
1485
+ unlinkAsync (ctx. arg . cmseOutputLib );
1486
1486
Expected<std::unique_ptr<FileOutputBuffer>> bufferOrErr =
1487
- FileOutputBuffer::create (config-> cmseOutputLib , fileSize, flags);
1487
+ FileOutputBuffer::create (ctx. arg . cmseOutputLib , fileSize, flags);
1488
1488
if (!bufferOrErr) {
1489
- error (" failed to open " + config-> cmseOutputLib + " : " +
1489
+ error (" failed to open " + ctx. arg . cmseOutputLib + " : " +
1490
1490
llvm::toString (bufferOrErr.takeError ()));
1491
1491
return ;
1492
1492
}
@@ -1500,13 +1500,13 @@ template <typename ELFT> void elf::writeARMCmseImportLib() {
1500
1500
eHdr->e_entry = 0 ;
1501
1501
eHdr->e_shoff = sectionHeaderOff;
1502
1502
eHdr->e_ident [EI_CLASS] = ELFCLASS32;
1503
- eHdr->e_ident [EI_DATA] = config-> isLE ? ELFDATA2LSB : ELFDATA2MSB;
1503
+ eHdr->e_ident [EI_DATA] = ctx. arg . isLE ? ELFDATA2LSB : ELFDATA2MSB;
1504
1504
eHdr->e_ident [EI_VERSION] = EV_CURRENT;
1505
- eHdr->e_ident [EI_OSABI] = config-> osabi ;
1505
+ eHdr->e_ident [EI_OSABI] = ctx. arg . osabi ;
1506
1506
eHdr->e_ident [EI_ABIVERSION] = 0 ;
1507
1507
eHdr->e_machine = EM_ARM;
1508
1508
eHdr->e_version = EV_CURRENT;
1509
- eHdr->e_flags = config-> eflags ;
1509
+ eHdr->e_flags = ctx. arg . eflags ;
1510
1510
eHdr->e_ehsize = sizeof (typename ELFT::Ehdr);
1511
1511
eHdr->e_phnum = 0 ;
1512
1512
eHdr->e_shentsize = sizeof (typename ELFT::Shdr);
0 commit comments