@@ -59,7 +59,7 @@ using llvm::support::endian::write64le;
59
59
60
60
constexpr size_t MergeNoTailSection::numShards;
61
61
62
- static uint64_t readUint (uint8_t *buf) {
62
+ static uint64_t readUint (Ctx &ctx, uint8_t *buf) {
63
63
return ctx.arg .is64 ? read64 (buf) : read32 (buf);
64
64
}
65
65
@@ -267,7 +267,7 @@ MipsReginfoSection<ELFT>::create(Ctx &ctx) {
267
267
return std::make_unique<MipsReginfoSection<ELFT>>(ctx, reginfo);
268
268
}
269
269
270
- InputSection *elf::createInterpSection () {
270
+ InputSection *elf::createInterpSection (Ctx & ) {
271
271
// StringSaver guarantees that the returned string ends with '\0'.
272
272
StringRef s = saver ().save (ctx.arg .dynamicLinker );
273
273
ArrayRef<uint8_t > contents = {(const uint8_t *)s.data (), s.size () + 1 };
@@ -609,7 +609,7 @@ static uint64_t readFdeAddr(uint8_t *buf, int size) {
609
609
case DW_EH_PE_sdata8:
610
610
return read64 (buf);
611
611
case DW_EH_PE_absptr:
612
- return readUint (buf);
612
+ return readUint (ctx, buf);
613
613
}
614
614
fatal (" unknown FDE size encoding" );
615
615
}
@@ -1452,15 +1452,17 @@ DynamicSection<ELFT>::computeContents() {
1452
1452
addInSec (DT_PLTGOT, *ctx.in .plt );
1453
1453
break ;
1454
1454
case EM_AARCH64:
1455
- if (llvm::find_if (ctx.in .relaPlt ->relocs , [](const DynamicReloc &r) {
1455
+ if (llvm::find_if (ctx.in .relaPlt ->relocs , [&ctx = ctx](
1456
+ const DynamicReloc &r) {
1456
1457
return r.type == ctx.target ->pltRel &&
1457
1458
r.sym ->stOther & STO_AARCH64_VARIANT_PCS;
1458
1459
}) != ctx.in .relaPlt ->relocs .end ())
1459
1460
addInt (DT_AARCH64_VARIANT_PCS, 0 );
1460
1461
addInSec (DT_PLTGOT, *ctx.in .gotPlt );
1461
1462
break ;
1462
1463
case EM_RISCV:
1463
- if (llvm::any_of (ctx.in .relaPlt ->relocs , [](const DynamicReloc &r) {
1464
+ if (llvm::any_of (ctx.in .relaPlt ->relocs , [&ctx = ctx](
1465
+ const DynamicReloc &r) {
1464
1466
return r.type == ctx.target ->pltRel &&
1465
1467
(r.sym ->stOther & STO_RISCV_VARIANT_CC);
1466
1468
}))
@@ -2441,7 +2443,7 @@ void GnuHashTableSection::writeTo(Ctx &ctx, uint8_t *buf) {
2441
2443
// When C = 64, we choose a word with bits [6:...] and set 1 to two bits in
2442
2444
// the word using bits [0:5] and [26:31].
2443
2445
size_t i = (sym.hash / c) & (maskWords - 1 );
2444
- uint64_t val = readUint (buf + i * ctx.arg .wordsize );
2446
+ uint64_t val = readUint (ctx, buf + i * ctx.arg .wordsize );
2445
2447
val |= uint64_t (1 ) << (sym.hash % c);
2446
2448
val |= uint64_t (1 ) << ((sym.hash >> Shift2) % c);
2447
2449
writeUint (buf + i * ctx.arg .wordsize , val);
@@ -3513,7 +3515,7 @@ createSymbols(
3513
3515
3514
3516
// Returns a newly-created .gdb_index section.
3515
3517
template <class ELFT >
3516
- std::unique_ptr<GdbIndexSection> GdbIndexSection::create (Ctx &) {
3518
+ std::unique_ptr<GdbIndexSection> GdbIndexSection::create (Ctx &ctx ) {
3517
3519
llvm::TimeTraceScope timeScope (" Create gdb index" );
3518
3520
3519
3521
// Collect InputFiles with .debug_info. See the comment in
@@ -4684,7 +4686,7 @@ template <class ELFT> void elf::createSyntheticSections(Ctx &ctx) {
4684
4686
// SyntheticSections coming last.
4685
4687
if (needsInterpSection (ctx)) {
4686
4688
for (size_t i = 1 ; i <= ctx.partitions .size (); ++i) {
4687
- InputSection *sec = createInterpSection ();
4689
+ InputSection *sec = createInterpSection (ctx );
4688
4690
sec->partition = i;
4689
4691
ctx.inputSections .push_back (sec);
4690
4692
}
0 commit comments