Skip to content

Commit a7e14e2

Browse files
committed
[ELF] Replace config-> with ctx.arg.
1 parent 6f48201 commit a7e14e2

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

lld/ELF/DWARF.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ LLDDwarfObj<ELFT>::findAux(const InputSectionBase &sec, uint64_t pos,
112112
const RelTy &rel = *it;
113113

114114
const ObjFile<ELFT> *file = sec.getFile<ELFT>();
115-
uint32_t symIndex = rel.getSymbol(config->isMips64EL);
115+
uint32_t symIndex = rel.getSymbol(ctx.arg.isMips64EL);
116116
const typename ELFT::Sym &sym = file->template getELFSyms<ELFT>()[symIndex];
117117
uint32_t secIndex = file->getSectionIndex(sym);
118118

lld/ELF/DriverUtils.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,15 +137,15 @@ opt::InputArgList ELFOptTable::parse(ArrayRef<const char *> argv) {
137137

138138
void elf::printHelp() {
139139
ELFOptTable().printHelp(
140-
lld::outs(), (config->progName + " [options] file...").str().c_str(),
140+
lld::outs(), (ctx.arg.progName + " [options] file...").str().c_str(),
141141
"lld", false /*ShowHidden*/, true /*ShowAllAliases*/);
142142
lld::outs() << "\n";
143143

144144
// Scripts generated by Libtool versions up to 2021-10 expect /: supported
145145
// targets:.* elf/ in a message for the --help option. If it doesn't match,
146146
// the scripts assume that the linker doesn't support very basic features
147147
// such as shared libraries. Therefore, we need to print out at least "elf".
148-
lld::outs() << config->progName << ": supported targets: elf\n";
148+
lld::outs() << ctx.arg.progName << ": supported targets: elf\n";
149149
}
150150

151151
static std::string rewritePath(StringRef s) {
@@ -214,7 +214,7 @@ static std::optional<std::string> findFile(StringRef path1,
214214
const Twine &path2) {
215215
SmallString<128> s;
216216
if (path1.starts_with("="))
217-
path::append(s, config->sysroot, path1.substr(1), path2);
217+
path::append(s, ctx.arg.sysroot, path1.substr(1), path2);
218218
else
219219
path::append(s, path1, path2);
220220

@@ -224,7 +224,7 @@ static std::optional<std::string> findFile(StringRef path1,
224224
}
225225

226226
std::optional<std::string> elf::findFromSearchPaths(StringRef path) {
227-
for (StringRef dir : config->searchPaths)
227+
for (StringRef dir : ctx.arg.searchPaths)
228228
if (std::optional<std::string> s = findFile(dir, path))
229229
return s;
230230
return std::nullopt;
@@ -233,8 +233,8 @@ std::optional<std::string> elf::findFromSearchPaths(StringRef path) {
233233
// This is for -l<basename>. We'll look for lib<basename>.so or lib<basename>.a from
234234
// search paths.
235235
std::optional<std::string> elf::searchLibraryBaseName(StringRef name) {
236-
for (StringRef dir : config->searchPaths) {
237-
if (!config->isStatic)
236+
for (StringRef dir : ctx.arg.searchPaths) {
237+
if (!ctx.arg.isStatic)
238238
if (std::optional<std::string> s = findFile(dir, "lib" + name + ".so"))
239239
return s;
240240
if (std::optional<std::string> s = findFile(dir, "lib" + name + ".a"))

lld/ELF/EhFrame.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ static size_t getAugPSize(unsigned enc) {
101101
switch (enc & 0x0f) {
102102
case DW_EH_PE_absptr:
103103
case DW_EH_PE_signed:
104-
return config->wordsize;
104+
return ctx.arg.wordsize;
105105
case DW_EH_PE_udata2:
106106
case DW_EH_PE_sdata2:
107107
return 2;

lld/ELF/LTO.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,9 @@ BitcodeCompiler::~BitcodeCompiler() = default;
214214

215215
void BitcodeCompiler::add(BitcodeFile &f) {
216216
lto::InputFile &obj = *f.obj;
217-
bool isExec = !config->shared && !config->relocatable;
217+
bool isExec = !ctx.arg.shared && !ctx.arg.relocatable;
218218

219-
if (config->thinLTOEmitIndexFiles)
219+
if (ctx.arg.thinLTOEmitIndexFiles)
220220
thinIndices.insert(obj.getName());
221221

222222
ArrayRef<Symbol *> syms = f.getSymbols();
@@ -244,15 +244,15 @@ void BitcodeCompiler::add(BitcodeFile &f) {
244244
// 4) Symbols that are defined in bitcode files and used for dynamic
245245
// linking.
246246
// 5) Symbols that will be referenced after linker wrapping is performed.
247-
r.VisibleToRegularObj = config->relocatable || sym->isUsedInRegularObj ||
247+
r.VisibleToRegularObj = ctx.arg.relocatable || sym->isUsedInRegularObj ||
248248
sym->referencedAfterWrap ||
249249
(r.Prevailing && sym->includeInDynsym()) ||
250250
usedStartStop.count(objSym.getSectionName());
251251
// Identify symbols exported dynamically, and that therefore could be
252252
// referenced by a shared library not visible to the linker.
253253
r.ExportDynamic =
254254
sym->computeBinding() != STB_LOCAL &&
255-
(config->exportDynamic || sym->exportDynamic || sym->inDynamicList);
255+
(ctx.arg.exportDynamic || sym->exportDynamic || sym->inDynamicList);
256256
const auto *dr = dyn_cast<Defined>(sym);
257257
r.FinalDefinitionInLinkageUnit =
258258
(isExec || sym->visibility() != STV_DEFAULT) && dr &&
@@ -299,7 +299,7 @@ static void thinLTOCreateEmptyIndexFiles() {
299299
ModuleSummaryIndex m(/*HaveGVs*/ false);
300300
m.setSkipModuleByDistributedBackend();
301301
writeIndexToFile(m, *os);
302-
if (config->thinLTOEmitImportsFiles)
302+
if (ctx.arg.thinLTOEmitImportsFiles)
303303
openFile(path + ".imports");
304304
}
305305
}

0 commit comments

Comments
 (0)