@@ -59,7 +59,7 @@ using llvm::support::endian::write64le;
5959
6060constexpr size_t MergeNoTailSection::numShards;
6161
62- static uint64_t readUint (uint8_t *buf) {
62+ static uint64_t readUint (Ctx &ctx, uint8_t *buf) {
6363 return ctx.arg .is64 ? read64 (buf) : read32 (buf);
6464}
6565
@@ -267,7 +267,7 @@ MipsReginfoSection<ELFT>::create(Ctx &ctx) {
267267 return std::make_unique<MipsReginfoSection<ELFT>>(ctx, reginfo);
268268}
269269
270- InputSection *elf::createInterpSection () {
270+ InputSection *elf::createInterpSection (Ctx & ) {
271271 // StringSaver guarantees that the returned string ends with '\0'.
272272 StringRef s = saver ().save (ctx.arg .dynamicLinker );
273273 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) {
609609 case DW_EH_PE_sdata8:
610610 return read64 (buf);
611611 case DW_EH_PE_absptr:
612- return readUint (buf);
612+ return readUint (ctx, buf);
613613 }
614614 fatal (" unknown FDE size encoding" );
615615}
@@ -1452,15 +1452,17 @@ DynamicSection<ELFT>::computeContents() {
14521452 addInSec (DT_PLTGOT, *ctx.in .plt );
14531453 break ;
14541454 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) {
14561457 return r.type == ctx.target ->pltRel &&
14571458 r.sym ->stOther & STO_AARCH64_VARIANT_PCS;
14581459 }) != ctx.in .relaPlt ->relocs .end ())
14591460 addInt (DT_AARCH64_VARIANT_PCS, 0 );
14601461 addInSec (DT_PLTGOT, *ctx.in .gotPlt );
14611462 break ;
14621463 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) {
14641466 return r.type == ctx.target ->pltRel &&
14651467 (r.sym ->stOther & STO_RISCV_VARIANT_CC);
14661468 }))
@@ -2441,7 +2443,7 @@ void GnuHashTableSection::writeTo(Ctx &ctx, uint8_t *buf) {
24412443 // When C = 64, we choose a word with bits [6:...] and set 1 to two bits in
24422444 // the word using bits [0:5] and [26:31].
24432445 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 );
24452447 val |= uint64_t (1 ) << (sym.hash % c);
24462448 val |= uint64_t (1 ) << ((sym.hash >> Shift2) % c);
24472449 writeUint (buf + i * ctx.arg .wordsize , val);
@@ -3513,7 +3515,7 @@ createSymbols(
35133515
35143516// Returns a newly-created .gdb_index section.
35153517template <class ELFT >
3516- std::unique_ptr<GdbIndexSection> GdbIndexSection::create (Ctx &) {
3518+ std::unique_ptr<GdbIndexSection> GdbIndexSection::create (Ctx &ctx ) {
35173519 llvm::TimeTraceScope timeScope (" Create gdb index" );
35183520
35193521 // Collect InputFiles with .debug_info. See the comment in
@@ -4684,7 +4686,7 @@ template <class ELFT> void elf::createSyntheticSections(Ctx &ctx) {
46844686 // SyntheticSections coming last.
46854687 if (needsInterpSection (ctx)) {
46864688 for (size_t i = 1 ; i <= ctx.partitions .size (); ++i) {
4687- InputSection *sec = createInterpSection ();
4689+ InputSection *sec = createInterpSection (ctx );
46884690 sec->partition = i;
46894691 ctx.inputSections .push_back (sec);
46904692 }
0 commit comments