Skip to content

Commit f1dccda

Browse files
committed
[ELF] Pass Ctx & to Symbols
1 parent acb2b1e commit f1dccda

File tree

6 files changed

+10
-10
lines changed

6 files changed

+10
-10
lines changed

lld/ELF/Driver.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2951,7 +2951,7 @@ template <class ELFT> void LinkerDriver::link(opt::InputArgList &args) {
29512951
}
29522952
ctx.nonPrevailingSyms.clear();
29532953
for (const DuplicateSymbol &d : ctx.duplicates)
2954-
reportDuplicate(*d.sym, d.file, d.section, d.value);
2954+
reportDuplicate(ctx, *d.sym, d.file, d.section, d.value);
29552955
ctx.duplicates.clear();
29562956

29572957
// Return if there were name resolution errors.
@@ -3033,7 +3033,7 @@ template <class ELFT> void LinkerDriver::link(opt::InputArgList &args) {
30333033
});
30343034
parallelForEach(newObjectFiles, postParseObjectFile);
30353035
for (const DuplicateSymbol &d : ctx.duplicates)
3036-
reportDuplicate(*d.sym, d.file, d.section, d.value);
3036+
reportDuplicate(ctx, *d.sym, d.file, d.section, d.value);
30373037

30383038
// ELF dependent libraries may have introduced new input files after LTO has
30393039
// completed. This is an error if the files haven't already been parsed, since

lld/ELF/ICF.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ template <class ELFT> void ICF<ELFT>::run() {
471471
// by scanRelocations().
472472
if (ctx.arg.hasDynSymTab)
473473
for (Symbol *sym : ctx.symtab->getSymbols())
474-
sym->isPreemptible = computeIsPreemptible(*sym);
474+
sym->isPreemptible = computeIsPreemptible(ctx, *sym);
475475

476476
// Two text sections may have identical content and relocations but different
477477
// LSDA, e.g. the two functions may have catch blocks of different types. If a

lld/ELF/InputFiles.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1830,7 +1830,7 @@ void BitcodeFile::postParse() {
18301830
int c = irSym.getComdatIndex();
18311831
if (c != -1 && !keptComdats[c])
18321832
continue;
1833-
reportDuplicate(sym, this, nullptr, 0);
1833+
reportDuplicate(ctx, sym, this, nullptr, 0);
18341834
}
18351835
}
18361836

lld/ELF/Symbols.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ void elf::maybeWarnUnorderableSymbol(const Symbol *sym) {
334334

335335
// Returns true if a symbol can be replaced at load-time by a symbol
336336
// with the same name defined in other ELF executable or DSO.
337-
bool elf::computeIsPreemptible(const Symbol &sym) {
337+
bool elf::computeIsPreemptible(Ctx &ctx, const Symbol &sym) {
338338
assert(!sym.isLocal() || sym.isPlaceholder());
339339

340340
// Only symbols with default visibility that appear in dynsym can be
@@ -511,7 +511,7 @@ bool Symbol::shouldReplace(const Defined &other) const {
511511
return !isGlobal() && other.isGlobal();
512512
}
513513

514-
void elf::reportDuplicate(const Symbol &sym, const InputFile *newFile,
514+
void elf::reportDuplicate(Ctx &ctx, const Symbol &sym, const InputFile *newFile,
515515
InputSectionBase *errSec, uint64_t errOffset) {
516516
if (ctx.arg.allowMultipleDefinition)
517517
return;
@@ -555,7 +555,7 @@ void elf::reportDuplicate(const Symbol &sym, const InputFile *newFile,
555555

556556
void Symbol::checkDuplicate(const Defined &other) const {
557557
if (isDefined() && !isWeak() && !other.isWeak())
558-
reportDuplicate(*this, other.file,
558+
reportDuplicate(ctx, *this, other.file,
559559
dyn_cast_or_null<InputSectionBase>(other.section),
560560
other.value);
561561
}

lld/ELF/Symbols.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -525,10 +525,10 @@ template <typename... T> Defined *makeDefined(T &&...args) {
525525
return &s;
526526
}
527527

528-
void reportDuplicate(const Symbol &sym, const InputFile *newFile,
528+
void reportDuplicate(Ctx &, const Symbol &sym, const InputFile *newFile,
529529
InputSectionBase *errSec, uint64_t errOffset);
530530
void maybeWarnUnorderableSymbol(const Symbol *sym);
531-
bool computeIsPreemptible(const Symbol &sym);
531+
bool computeIsPreemptible(Ctx &, const Symbol &sym);
532532

533533
} // namespace elf
534534
} // namespace lld

lld/ELF/Writer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ static void demoteSymbolsAndComputeIsPreemptible(Ctx &ctx) {
290290
}
291291

292292
if (ctx.arg.hasDynSymTab)
293-
sym->isPreemptible = computeIsPreemptible(*sym);
293+
sym->isPreemptible = computeIsPreemptible(ctx, *sym);
294294
}
295295
}
296296

0 commit comments

Comments
 (0)