summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lld/COFF/Chunks.cpp6
-rw-r--r--lld/COFF/InputFiles.cpp30
2 files changed, 17 insertions, 19 deletions
diff --git a/lld/COFF/Chunks.cpp b/lld/COFF/Chunks.cpp
index 149343a3a7c..cdace070c6c 100644
--- a/lld/COFF/Chunks.cpp
+++ b/lld/COFF/Chunks.cpp
@@ -251,8 +251,7 @@ void SectionChunk::writeTo(uint8_t *Buf) const {
// Get the output section of the symbol for this relocation. The output
// section is needed to compute SECREL and SECTION relocations used in debug
// info.
- Symbol *Body = File->getSymbol(Rel.SymbolTableIndex);
- Defined *Sym = cast<Defined>(Body);
+ Defined *Sym = cast<Defined>(File->getSymbol(Rel.SymbolTableIndex));
Chunk *C = Sym->getChunk();
OutputSection *OS = C ? C->getOutputSection() : nullptr;
@@ -328,8 +327,7 @@ void SectionChunk::getBaserels(std::vector<Baserel> *Res) {
uint8_t Ty = getBaserelType(Rel);
if (Ty == IMAGE_REL_BASED_ABSOLUTE)
continue;
- Symbol *Body = File->getSymbol(Rel.SymbolTableIndex);
- if (isa<DefinedAbsolute>(Body))
+ if (isa<DefinedAbsolute>(File->getSymbol(Rel.SymbolTableIndex)))
continue;
Res->emplace_back(RVA + Rel.VirtualAddress, Ty);
}
diff --git a/lld/COFF/InputFiles.cpp b/lld/COFF/InputFiles.cpp
index 4b6ee470f77..b7f046a2faa 100644
--- a/lld/COFF/InputFiles.cpp
+++ b/lld/COFF/InputFiles.cpp
@@ -179,30 +179,30 @@ void ObjFile::initializeSymbols() {
int32_t LastSectionNumber = 0;
for (uint32_t I = 0; I < NumSymbols; ++I) {
- COFFSymbolRef Sym = check(COFFObj->getSymbol(I));
+ COFFSymbolRef COFFSym = check(COFFObj->getSymbol(I));
const void *AuxP = nullptr;
- if (Sym.getNumberOfAuxSymbols())
+ if (COFFSym.getNumberOfAuxSymbols())
AuxP = check(COFFObj->getSymbol(I + 1)).getRawPtr();
- bool IsFirst = (LastSectionNumber != Sym.getSectionNumber());
+ bool IsFirst = (LastSectionNumber != COFFSym.getSectionNumber());
- Symbol *Body = nullptr;
- if (Sym.isUndefined()) {
- Body = createUndefined(Sym);
- } else if (Sym.isWeakExternal()) {
- Body = createUndefined(Sym);
+ Symbol *Sym = nullptr;
+ if (COFFSym.isUndefined()) {
+ Sym = createUndefined(COFFSym);
+ } else if (COFFSym.isWeakExternal()) {
+ Sym = createUndefined(COFFSym);
uint32_t TagIndex =
static_cast<const coff_aux_weak_external *>(AuxP)->TagIndex;
- WeakAliases.emplace_back(Body, TagIndex);
+ WeakAliases.emplace_back(Sym, TagIndex);
} else {
- Body = createDefined(Sym, AuxP, IsFirst);
+ Sym = createDefined(COFFSym, AuxP, IsFirst);
}
- if (Body) {
- SymbolBodies.push_back(Body);
- SparseSymbolBodies[I] = Body;
+ if (Sym) {
+ SymbolBodies.push_back(Sym);
+ SparseSymbolBodies[I] = Sym;
}
- I += Sym.getNumberOfAuxSymbols();
- LastSectionNumber = Sym.getSectionNumber();
+ I += COFFSym.getNumberOfAuxSymbols();
+ LastSectionNumber = COFFSym.getSectionNumber();
}
for (auto &KV : WeakAliases) {
OpenPOWER on IntegriCloud