Skip to content

Commit b8248da

Browse files
committed
[ELF] Replace remnant config-> with ctx.arg.
1 parent 777329d commit b8248da

File tree

8 files changed

+12
-14
lines changed

8 files changed

+12
-14
lines changed

lld/ELF/Arch/MipsArchTree.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ bool elf::isMipsN32Abi(const InputFile *f) {
377377
case ELF64BEKind:
378378
return isN32Abi<ELF64BE>(f);
379379
default:
380-
llvm_unreachable("unknown Config->EKind");
380+
llvm_unreachable("unknown ctx.arg.ekind");
381381
}
382382
}
383383

lld/ELF/CallGraphSort.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ constexpr uint64_t MAX_CLUSTER_SIZE = 1024 * 1024;
108108
using SectionPair =
109109
std::pair<const InputSectionBase *, const InputSectionBase *>;
110110

111-
// Take the edge list in Config->CallGraphProfile, resolve symbol names to
111+
// Take the edge list in ctx.arg.callGraphProfile, resolve symbol names to
112112
// Symbols, and generate a graph between InputSections with the provided
113113
// weights.
114114
CallGraphSort::CallGraphSort() {

lld/ELF/Driver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2106,7 +2106,7 @@ static uint64_t getCommonPageSize(Ctx &ctx, opt::InputArgList &args) {
21062106

21072107
// Parses --image-base option.
21082108
static std::optional<uint64_t> getImageBase(Ctx &ctx, opt::InputArgList &args) {
2109-
// Because we are using "Config->maxPageSize" here, this function has to be
2109+
// Because we are using `ctx.arg.maxPageSize` here, this function has to be
21102110
// called after the variable is initialized.
21112111
auto *arg = args.getLastArg(OPT_image_base);
21122112
if (!arg)

lld/ELF/InputSection.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@ static int64_t getTlsTpOffset(const Symbol &s) {
713713
return s.getVA(0) - tls->p_memsz -
714714
((-tls->p_vaddr - tls->p_memsz) & (tls->p_align - 1));
715715
default:
716-
llvm_unreachable("unhandled Config->EMachine");
716+
llvm_unreachable("unhandled ctx.arg.emachine");
717717
}
718718
}
719719

lld/ELF/LinkerScript.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1634,7 +1634,7 @@ SmallVector<PhdrEntry *, 0> LinkerScript::createPhdrs() {
16341634
// Process PHDRS and FILEHDR keywords because they are not
16351635
// real output sections and cannot be added in the following loop.
16361636
for (const PhdrsCommand &cmd : phdrsCommands) {
1637-
PhdrEntry *phdr = make<PhdrEntry>(cmd.type, cmd.flags.value_or(PF_R));
1637+
PhdrEntry *phdr = make<PhdrEntry>(ctx, cmd.type, cmd.flags.value_or(PF_R));
16381638

16391639
if (cmd.hasFilehdr)
16401640
phdr->add(ctx.out.elfHeader);

lld/ELF/SyntheticSections.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2057,8 +2057,6 @@ template <class ELFT> bool RelrSection<ELFT>::updateAllocSize() {
20572057
size_t oldSize = relrRelocs.size();
20582058
relrRelocs.clear();
20592059

2060-
// Same as Config->Wordsize but faster because this is a compile-time
2061-
// constant.
20622060
const size_t wordsize = sizeof(typename ELFT::uint);
20632061

20642062
// Number of bits to use for the relocation offsets bitmap.

lld/ELF/Writer.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2175,8 +2175,8 @@ static uint64_t computeFlags(uint64_t flags) {
21752175
template <class ELFT>
21762176
SmallVector<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
}

lld/ELF/Writer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ template <class ELFT> void writeResult(Ctx &ctx);
2323
// Each contains type, access flags and range of output sections that will be
2424
// placed in it.
2525
struct PhdrEntry {
26-
PhdrEntry(unsigned type, unsigned flags)
27-
: p_align(type == llvm::ELF::PT_LOAD ? config->maxPageSize : 0),
26+
PhdrEntry(Ctx &ctx, unsigned type, unsigned flags)
27+
: p_align(type == llvm::ELF::PT_LOAD ? ctx.arg.maxPageSize : 0),
2828
p_type(type), p_flags(flags) {}
2929
void add(OutputSection *sec);
3030

0 commit comments

Comments
 (0)