Skip to content

Commit

Permalink
[ELF] De-template Symbol::resolveLazy. NFC
Browse files Browse the repository at this point in the history
  • Loading branch information
MaskRay committed Feb 24, 2022
1 parent f3c9a52 commit 4129890
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
13 changes: 4 additions & 9 deletions lld/ELF/Symbols.cpp
Expand Up @@ -650,20 +650,15 @@ void Symbol::resolveDefined(const Defined &other) {
replace(other);
}

template <class LazyT>
static void replaceCommon(Symbol &oldSym, const LazyT &newSym) {
backwardReferences.erase(&oldSym);
oldSym.replace(newSym);
newSym.extract();
}

template <class LazyT> void Symbol::resolveLazy(const LazyT &other) {
void Symbol::resolveLazy(const LazyObject &other) {
// For common objects, we want to look for global or weak definitions that
// should be extracted as the canonical definition instead.
if (isCommon() && elf::config->fortranCommon) {
if (auto *loSym = dyn_cast<LazyObject>(&other)) {
if (loSym->file->shouldExtractForCommon(getName())) {
replaceCommon(*this, other);
backwardReferences.erase(this);
replace(other);
other.extract();
return;
}
}
Expand Down
3 changes: 2 additions & 1 deletion lld/ELF/Symbols.h
Expand Up @@ -36,6 +36,7 @@ class InputSectionBase;
class SharedSymbol;
class Symbol;
class Undefined;
class LazyObject;
class InputFile;

// Some index properties of a symbol are stored separately in this auxiliary
Expand Down Expand Up @@ -224,7 +225,7 @@ class Symbol {
void resolveUndefined(const Undefined &other);
void resolveCommon(const CommonSymbol &other);
void resolveDefined(const Defined &other);
template <class LazyT> void resolveLazy(const LazyT &other);
void resolveLazy(const LazyObject &other);
void resolveShared(const SharedSymbol &other);

int compare(const Symbol *other) const;
Expand Down

0 comments on commit 4129890

Please sign in to comment.