@@ -2175,8 +2175,8 @@ static uint64_t computeFlags(uint64_t flags) {
21752175template <class ELFT >
21762176SmallVector<PhdrEntry *, 0 > Writer<ELFT>::createPhdrs(Partition &part) {
21772177 SmallVector<PhdrEntry *, 0 > ret;
2178- auto addHdr = [&](unsigned type, unsigned flags) -> PhdrEntry * {
2179- ret.push_back (make<PhdrEntry>(type, flags));
2178+ auto addHdr = [&, &ctx = ctx ](unsigned type, unsigned flags) -> PhdrEntry * {
2179+ ret.push_back (make<PhdrEntry>(ctx, type, flags));
21802180 return ret.back ();
21812181 };
21822182
@@ -2215,7 +2215,7 @@ SmallVector<PhdrEntry *, 0> Writer<ELFT>::createPhdrs(Partition &part) {
22152215 // read-only by dynamic linker after processing relocations.
22162216 // Current dynamic loaders only support one PT_GNU_RELRO PHDR, give
22172217 // an error message if more than one PT_GNU_RELRO PHDR is required.
2218- PhdrEntry *relRo = make<PhdrEntry>(PT_GNU_RELRO, PF_R);
2218+ PhdrEntry *relRo = make<PhdrEntry>(ctx, PT_GNU_RELRO, PF_R);
22192219 bool inRelroPhdr = false ;
22202220 OutputSection *relroEnd = nullptr ;
22212221 for (OutputSection *sec : ctx.outputSections ) {
@@ -2292,7 +2292,7 @@ SmallVector<PhdrEntry *, 0> Writer<ELFT>::createPhdrs(Partition &part) {
22922292 }
22932293
22942294 // Add a TLS segment if any.
2295- PhdrEntry *tlsHdr = make<PhdrEntry>(PT_TLS, PF_R);
2295+ PhdrEntry *tlsHdr = make<PhdrEntry>(ctx, PT_TLS, PF_R);
22962296 for (OutputSection *sec : ctx.outputSections )
22972297 if (sec->partition == partNo && sec->flags & SHF_TLS)
22982298 tlsHdr->add (sec);
@@ -2377,7 +2377,7 @@ void Writer<ELFT>::addPhdrForSection(Partition &part, unsigned shType,
23772377 if (i == ctx.outputSections .end ())
23782378 return ;
23792379
2380- PhdrEntry *entry = make<PhdrEntry>(pType, pFlags);
2380+ PhdrEntry *entry = make<PhdrEntry>(ctx, pType, pFlags);
23812381 entry->add (*i);
23822382 part.phdrs .push_back (entry);
23832383}
0 commit comments