Skip to content

Commit 7071a25

Browse files
authored
[ELF] Rename LazyObject to LazySymbol. NFC
LazySymbol (used by wasm port) is a more accurate name (the struct is not about an object). However, the ELF port calls this LazyObject likely because we used to have LazyArchive (removed by https://reviews.llvm.org/D119074), and LazyObject has a similar naming convention (LazyObjectSymbol would be better, but it is too long). Reviewers: dschuff Pull Request: #78809
1 parent 4684507 commit 7071a25

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

lld/ELF/InputFiles.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1739,7 +1739,7 @@ void BitcodeFile::parseLazy() {
17391739
for (auto [i, irSym] : llvm::enumerate(obj->symbols()))
17401740
if (!irSym.isUndefined()) {
17411741
auto *sym = symtab.insert(saver().save(irSym.getName()));
1742-
sym->resolve(LazyObject{*this});
1742+
sym->resolve(LazySymbol{*this});
17431743
symbols[i] = sym;
17441744
}
17451745
}
@@ -1821,7 +1821,7 @@ template <class ELFT> void ObjFile<ELFT>::parseLazy() {
18211821
if (eSyms[i].st_shndx == SHN_UNDEF)
18221822
continue;
18231823
symbols[i] = symtab.insert(CHECK(eSyms[i].getName(stringTable), this));
1824-
symbols[i]->resolve(LazyObject{*this});
1824+
symbols[i]->resolve(LazySymbol{*this});
18251825
if (!lazy)
18261826
break;
18271827
}

lld/ELF/Symbols.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ LLVM_ATTRIBUTE_UNUSED static inline void assertSymbols() {
4040
AssertSymbol<CommonSymbol>();
4141
AssertSymbol<Undefined>();
4242
AssertSymbol<SharedSymbol>();
43-
AssertSymbol<LazyObject>();
43+
AssertSymbol<LazySymbol>();
4444
}
4545

4646
// Returns a symbol for an error message.
@@ -146,7 +146,7 @@ static uint64_t getSymVA(const Symbol &sym, int64_t addend) {
146146
case Symbol::SharedKind:
147147
case Symbol::UndefinedKind:
148148
return 0;
149-
case Symbol::LazyObjectKind:
149+
case Symbol::LazyKind:
150150
llvm_unreachable("lazy symbol reached writer");
151151
case Symbol::CommonKind:
152152
llvm_unreachable("common symbol reached writer");
@@ -623,7 +623,7 @@ void Symbol::resolve(const Defined &other) {
623623
other.overwrite(*this);
624624
}
625625

626-
void Symbol::resolve(const LazyObject &other) {
626+
void Symbol::resolve(const LazySymbol &other) {
627627
if (isPlaceholder()) {
628628
other.overwrite(*this);
629629
return;

lld/ELF/Symbols.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class InputSectionBase;
3737
class SharedSymbol;
3838
class Symbol;
3939
class Undefined;
40-
class LazyObject;
40+
class LazySymbol;
4141
class InputFile;
4242

4343
void printTraceSymbol(const Symbol &sym, StringRef name);
@@ -76,7 +76,7 @@ class Symbol {
7676
CommonKind,
7777
SharedKind,
7878
UndefinedKind,
79-
LazyObjectKind,
79+
LazyKind,
8080
};
8181

8282
Kind kind() const { return static_cast<Kind>(symbolKind); }
@@ -181,7 +181,7 @@ class Symbol {
181181

182182
bool isLocal() const { return binding == llvm::ELF::STB_LOCAL; }
183183

184-
bool isLazy() const { return symbolKind == LazyObjectKind; }
184+
bool isLazy() const { return symbolKind == LazyKind; }
185185

186186
// True if this is an undefined weak symbol. This only works once
187187
// all input files have been added.
@@ -237,7 +237,7 @@ class Symbol {
237237
void resolve(const Undefined &other);
238238
void resolve(const CommonSymbol &other);
239239
void resolve(const Defined &other);
240-
void resolve(const LazyObject &other);
240+
void resolve(const LazySymbol &other);
241241
void resolve(const SharedSymbol &other);
242242

243243
// If this is a lazy symbol, extract an input file and add the symbol
@@ -471,7 +471,7 @@ class SharedSymbol : public Symbol {
471471
uint32_t alignment;
472472
};
473473

474-
// LazyObject symbols represent symbols in object files between --start-lib and
474+
// LazySymbol symbols represent symbols in object files between --start-lib and
475475
// --end-lib options. LLD also handles traditional archives as if all the files
476476
// in the archive are surrounded by --start-lib and --end-lib.
477477
//
@@ -480,14 +480,14 @@ class SharedSymbol : public Symbol {
480480
// and the lazy. We represent that with a lazy symbol with a weak binding. This
481481
// means that code looking for undefined symbols normally also has to take lazy
482482
// symbols into consideration.
483-
class LazyObject : public Symbol {
483+
class LazySymbol : public Symbol {
484484
public:
485-
LazyObject(InputFile &file)
486-
: Symbol(LazyObjectKind, &file, {}, llvm::ELF::STB_GLOBAL,
485+
LazySymbol(InputFile &file)
486+
: Symbol(LazyKind, &file, {}, llvm::ELF::STB_GLOBAL,
487487
llvm::ELF::STV_DEFAULT, llvm::ELF::STT_NOTYPE) {}
488-
void overwrite(Symbol &sym) const { Symbol::overwrite(sym, LazyObjectKind); }
488+
void overwrite(Symbol &sym) const { Symbol::overwrite(sym, LazyKind); }
489489

490-
static bool classof(const Symbol *s) { return s->kind() == LazyObjectKind; }
490+
static bool classof(const Symbol *s) { return s->kind() == LazyKind; }
491491
};
492492

493493
// Some linker-generated symbols need to be created as
@@ -541,7 +541,7 @@ union SymbolUnion {
541541
alignas(CommonSymbol) char b[sizeof(CommonSymbol)];
542542
alignas(Undefined) char c[sizeof(Undefined)];
543543
alignas(SharedSymbol) char d[sizeof(SharedSymbol)];
544-
alignas(LazyObject) char e[sizeof(LazyObject)];
544+
alignas(LazySymbol) char e[sizeof(LazySymbol)];
545545
};
546546

547547
template <typename... T> Defined *makeDefined(T &&...args) {

0 commit comments

Comments
 (0)