Index: lld/trunk/ELF/Arch/Mips.cpp =================================================================== --- lld/trunk/ELF/Arch/Mips.cpp +++ lld/trunk/ELF/Arch/Mips.cpp @@ -346,7 +346,7 @@ // If current file has PIC code, LA25 stub is not required. if (F->getObj().getHeader()->e_flags & EF_MIPS_PIC) return false; - auto *D = dyn_cast(&S); + auto *D = dyn_cast(&S); // LA25 is required if target file has PIC code // or target symbol is a PIC symbol. return D && D->isMipsPIC(); Index: lld/trunk/ELF/GdbIndex.cpp =================================================================== --- lld/trunk/ELF/GdbIndex.cpp +++ lld/trunk/ELF/GdbIndex.cpp @@ -67,7 +67,7 @@ const typename ELFT::Sym &Sym = File->getELFSyms()[SymIndex]; uint32_t SecIndex = File->getSectionIndex(Sym); Symbol &B = File->getRelocTargetSym(Rel); - auto &DR = cast(B); + auto &DR = cast(B); uint64_t Val = DR.Value + getAddend(Rel); // FIXME: We should be consistent about always adding the file Index: lld/trunk/ELF/ICF.cpp =================================================================== --- lld/trunk/ELF/ICF.cpp +++ lld/trunk/ELF/ICF.cpp @@ -228,8 +228,8 @@ return false; } - auto *DA = dyn_cast(&SA); - auto *DB = dyn_cast(&SB); + auto *DA = dyn_cast(&SA); + auto *DB = dyn_cast(&SB); if (!DA || !DB) return false; @@ -300,8 +300,8 @@ if (&SA == &SB) continue; - auto *DA = cast(&SA); - auto *DB = cast(&SB); + auto *DA = cast(&SA); + auto *DB = cast(&SB); // We already dealt with absolute and non-InputSection symbols in // constantEq, and for InputSections we have already checked everything Index: lld/trunk/ELF/InputFiles.cpp =================================================================== --- lld/trunk/ELF/InputFiles.cpp +++ lld/trunk/ELF/InputFiles.cpp @@ -600,8 +600,8 @@ if (Sym->st_shndx == SHN_UNDEF) return make(Name, /*IsLocal=*/true, StOther, Type); - return make(Name, /*IsLocal=*/true, StOther, Type, Value, - Size, Sec); + return make(Name, /*IsLocal=*/true, StOther, Type, Value, Size, + Sec); } StringRef Name = check(Sym->getName(this->StringTable), toString(this)); Index: lld/trunk/ELF/InputSection.h =================================================================== --- lld/trunk/ELF/InputSection.h +++ lld/trunk/ELF/InputSection.h @@ -27,7 +27,7 @@ class Symbol; struct SectionPiece; -class DefinedRegular; +class Defined; class SyntheticSection; class MergeSyntheticSection; template class ObjFile; @@ -73,7 +73,7 @@ // section. uint64_t getOffset(uint64_t Offset) const; - uint64_t getOffset(const DefinedRegular &Sym) const; + uint64_t getOffset(const Defined &Sym) const; protected: SectionBase(Kind SectionKind, StringRef Name, uint64_t Flags, Index: lld/trunk/ELF/InputSection.cpp =================================================================== --- lld/trunk/ELF/InputSection.cpp +++ lld/trunk/ELF/InputSection.cpp @@ -61,7 +61,7 @@ // Build a map from sections to their priorities. for (InputFile *File : ObjectFiles) { for (Symbol *Sym : File->getSymbols()) { - auto *D = dyn_cast(Sym); + auto *D = dyn_cast(Sym); if (!D || !D->Section) continue; int &Priority = SectionOrder[D->Section]; @@ -214,7 +214,7 @@ this->Flags &= ~(uint64_t)SHF_COMPRESSED; } -uint64_t SectionBase::getOffset(const DefinedRegular &Sym) const { +uint64_t SectionBase::getOffset(const Defined &Sym) const { return getOffset(Sym.Value); } @@ -251,7 +251,7 @@ // Find a function symbol that encloses a given location. for (Symbol *B : File->getSymbols()) - if (auto *D = dyn_cast(B)) + if (auto *D = dyn_cast(B)) if (D->Section == this && D->Type == STT_FUNC) if (D->Value <= Offset && Offset < D->Value + D->Size) return SrcFile + ":(function " + toString(*D) + ")"; @@ -317,7 +317,7 @@ // Find a symbol that encloses a given location. for (Symbol *B : File->getSymbols()) - if (auto *D = dyn_cast(B)) + if (auto *D = dyn_cast(B)) if (D->Section == this && D->Value <= Off && Off < D->Value + D->Size) return Filename + ":(" + toString(*D) + ")" + Archive; @@ -404,7 +404,7 @@ // avoid having to parse and recreate .eh_frame, we just replace any // relocation in it pointing to discarded sections with R_*_NONE, which // hopefully creates a frame that is ignored at runtime. - SectionBase *Section = cast(Sym).Section; + SectionBase *Section = cast(Sym).Section; if (Section == &InputSection::Discarded) { P->setSymbolAndType(0, 0, false); continue; Index: lld/trunk/ELF/LinkerScript.h =================================================================== --- lld/trunk/ELF/LinkerScript.h +++ lld/trunk/ELF/LinkerScript.h @@ -29,7 +29,7 @@ namespace lld { namespace elf { -class DefinedRegular; +class Defined; class Symbol; class InputSectionBase; class InputSection; @@ -96,7 +96,7 @@ // The LHS of an expression. Name is either a symbol name or ".". StringRef Name; - DefinedRegular *Sym = nullptr; + Defined *Sym = nullptr; // The RHS of an expression. Expr Expression; Index: lld/trunk/ELF/LinkerScript.cpp =================================================================== --- lld/trunk/ELF/LinkerScript.cpp +++ lld/trunk/ELF/LinkerScript.cpp @@ -149,9 +149,9 @@ // write expressions like this: `alignment = 16; . = ALIGN(., alignment)`. uint64_t SymValue = Value.Sec ? 0 : Value.getValue(); - replaceSymbol(Sym, nullptr, Cmd->Name, /*IsLocal=*/false, - Visibility, STT_NOTYPE, SymValue, 0, Sec); - Cmd->Sym = cast(Sym); + replaceSymbol(Sym, nullptr, Cmd->Name, /*IsLocal=*/false, Visibility, + STT_NOTYPE, SymValue, 0, Sec); + Cmd->Sym = cast(Sym); } // This function is called from assignAddresses, while we are @@ -977,7 +977,7 @@ return 0; } - if (auto *Sym = dyn_cast_or_null(Symtab->find(Name))) + if (auto *Sym = dyn_cast_or_null(Symtab->find(Name))) return {Sym->Section, false, Sym->Value, Loc}; error(Loc + ": symbol not found: " + Name); Index: lld/trunk/ELF/MapFile.cpp =================================================================== --- lld/trunk/ELF/MapFile.cpp +++ lld/trunk/ELF/MapFile.cpp @@ -51,7 +51,7 @@ std::vector V; for (InputFile *File : ObjectFiles) for (Symbol *B : File->getSymbols()) - if (auto *DR = dyn_cast(B)) + if (auto *DR = dyn_cast(B)) if (DR->getFile() == File && !DR->isSection() && DR->Section && DR->Section->Live) V.push_back(DR); @@ -62,7 +62,7 @@ static SymbolMapTy getSectionSyms(ArrayRef Syms) { SymbolMapTy Ret; for (Defined *S : Syms) - if (auto *DR = dyn_cast(S)) + if (auto *DR = dyn_cast(S)) Ret[DR->Section].push_back(S); // Sort symbols by address. We want to print out symbols in the Index: lld/trunk/ELF/MarkLive.cpp =================================================================== --- lld/trunk/ELF/MarkLive.cpp +++ lld/trunk/ELF/MarkLive.cpp @@ -64,7 +64,7 @@ std::function Fn) { Symbol &B = Sec.getFile()->getRelocTargetSym(Rel); - if (auto *D = dyn_cast(&B)) { + if (auto *D = dyn_cast(&B)) { if (!D->Section) return; uint64_t Offset = D->Value; @@ -212,7 +212,7 @@ }; auto MarkSymbol = [&](Symbol *Sym) { - if (auto *D = dyn_cast_or_null(Sym)) + if (auto *D = dyn_cast_or_null(Sym)) if (auto *IS = cast_or_null(D->Section)) Enqueue(IS, D->Value); }; Index: lld/trunk/ELF/OutputSections.h =================================================================== --- lld/trunk/ELF/OutputSections.h +++ lld/trunk/ELF/OutputSections.h @@ -33,7 +33,7 @@ template class ObjFile; template class SharedFile; class SharedSymbol; -class DefinedRegular; +class Defined; // This represents a section in an output file. // It is composed of multiple InputSections. Index: lld/trunk/ELF/Relocations.cpp =================================================================== --- lld/trunk/ELF/Relocations.cpp +++ lld/trunk/ELF/Relocations.cpp @@ -326,7 +326,7 @@ static bool isAbsolute(const Symbol &Sym) { if (Sym.isUndefWeak()) return true; - if (const auto *DR = dyn_cast(&Sym)) + if (const auto *DR = dyn_cast(&Sym)) return DR->Section == nullptr; // Absolute symbol. return false; } Index: lld/trunk/ELF/SymbolTable.h =================================================================== --- lld/trunk/ELF/SymbolTable.h +++ lld/trunk/ELF/SymbolTable.h @@ -41,9 +41,9 @@ ArrayRef getSymbols() const { return SymVector; } template - DefinedRegular *addAbsolute(StringRef Name, - uint8_t Visibility = llvm::ELF::STV_HIDDEN, - uint8_t Binding = llvm::ELF::STB_GLOBAL); + Defined *addAbsolute(StringRef Name, + uint8_t Visibility = llvm::ELF::STV_HIDDEN, + uint8_t Binding = llvm::ELF::STB_GLOBAL); template Symbol *addUndefined(StringRef Name); template Index: lld/trunk/ELF/SymbolTable.cpp =================================================================== --- lld/trunk/ELF/SymbolTable.cpp +++ lld/trunk/ELF/SymbolTable.cpp @@ -135,11 +135,11 @@ } template -DefinedRegular *SymbolTable::addAbsolute(StringRef Name, uint8_t Visibility, - uint8_t Binding) { +Defined *SymbolTable::addAbsolute(StringRef Name, uint8_t Visibility, + uint8_t Binding) { Symbol *Sym = addRegular(Name, Visibility, STT_NOTYPE, 0, 0, Binding, nullptr, nullptr); - return cast(Sym); + return cast(Sym); } // Set a flag for --trace-symbol so that we can print out a log message @@ -366,7 +366,7 @@ S->Binding = Binding; return Cmp; } - if (auto *R = dyn_cast(S)) { + if (auto *R = dyn_cast(S)) { if (R->Section && isa(R->Section)) { // Non-common symbols take precedence over common symbols. if (Config->WarnCommon) @@ -395,10 +395,10 @@ InputSections.push_back(Bss); S->Binding = Binding; - replaceSymbol(S, File, N, /*IsLocal=*/false, StOther, Type, - 0, Size, Bss); + replaceSymbol(S, File, N, /*IsLocal=*/false, StOther, Type, 0, + Size, Bss); } else if (Cmp == 0) { - auto *D = cast(S); + auto *D = cast(S); auto *Bss = dyn_cast_or_null(D->Section); if (!Bss) { // Non-common symbols take precedence over common symbols. @@ -435,7 +435,7 @@ template static void reportDuplicate(Symbol *Sym, InputSectionBase *ErrSec, typename ELFT::uint ErrOffset) { - DefinedRegular *D = dyn_cast(Sym); + Defined *D = dyn_cast(Sym); if (!D || !D->Section || !ErrSec) { reportDuplicate(Sym, ErrSec ? ErrSec->File : nullptr); return; @@ -475,8 +475,8 @@ int Cmp = compareDefinedNonCommon(S, WasInserted, Binding, Section == nullptr, Value, Name); if (Cmp > 0) - replaceSymbol(S, File, Name, /*IsLocal=*/false, StOther, - Type, Value, Size, Section); + replaceSymbol(S, File, Name, /*IsLocal=*/false, StOther, Type, + Value, Size, Section); else if (Cmp == 0) reportDuplicate(S, dyn_cast_or_null(Section), Value); @@ -519,8 +519,8 @@ int Cmp = compareDefinedNonCommon(S, WasInserted, Binding, /*IsAbs*/ false, /*Value*/ 0, Name); if (Cmp > 0) - replaceSymbol(S, F, Name, /*IsLocal=*/false, StOther, Type, - 0, 0, nullptr); + replaceSymbol(S, F, Name, /*IsLocal=*/false, StOther, Type, 0, 0, + nullptr); else if (Cmp == 0) reportDuplicate(S, F); return S; @@ -818,14 +818,14 @@ uint64_t, uint64_t, uint8_t, SectionBase *, InputFile *); -template DefinedRegular *SymbolTable::addAbsolute(StringRef, uint8_t, - uint8_t); -template DefinedRegular *SymbolTable::addAbsolute(StringRef, uint8_t, - uint8_t); -template DefinedRegular *SymbolTable::addAbsolute(StringRef, uint8_t, - uint8_t); -template DefinedRegular *SymbolTable::addAbsolute(StringRef, uint8_t, - uint8_t); +template Defined *SymbolTable::addAbsolute(StringRef, uint8_t, + uint8_t); +template Defined *SymbolTable::addAbsolute(StringRef, uint8_t, + uint8_t); +template Defined *SymbolTable::addAbsolute(StringRef, uint8_t, + uint8_t); +template Defined *SymbolTable::addAbsolute(StringRef, uint8_t, + uint8_t); template Symbol * SymbolTable::addLazyArchive(StringRef, ArchiveFile *, Index: lld/trunk/ELF/Symbols.h =================================================================== --- lld/trunk/ELF/Symbols.h +++ lld/trunk/ELF/Symbols.h @@ -38,9 +38,7 @@ class Symbol { public: enum Kind { - DefinedFirst, - DefinedRegularKind = DefinedFirst, - DefinedLast = DefinedRegularKind, + DefinedKind, SharedKind, UndefinedKind, LazyArchiveKind, @@ -95,7 +93,7 @@ bool isWeak() const { return Binding == llvm::ELF::STB_WEAK; } bool isUndefined() const { return SymbolKind == UndefinedKind; } - bool isDefined() const { return SymbolKind <= DefinedLast; } + bool isDefined() const { return SymbolKind == DefinedKind; } bool isShared() const { return SymbolKind == SharedKind; } bool isLocal() const { return IsLocal; } @@ -103,9 +101,7 @@ return SymbolKind == LazyArchiveKind || SymbolKind == LazyObjectKind; } - bool isInCurrentOutput() const { - return SymbolKind == DefinedRegularKind; - } + bool isInCurrentOutput() const { return isDefined(); } // True is this is an undefined weak symbol. This only works once // all input files have been added. @@ -188,29 +184,18 @@ StringRefZ Name; }; -// The base class for any defined symbols. +// Represents a symbol that is defined in the current output file. class Defined : public Symbol { public: - Defined(Kind K, StringRefZ Name, bool IsLocal, uint8_t StOther, uint8_t Type) - : Symbol(K, Name, IsLocal, StOther, Type) {} - - static bool classof(const Symbol *S) { return S->isDefined(); } -}; - -// Regular defined symbols read from object file symbol tables. -class DefinedRegular : public Defined { -public: - DefinedRegular(StringRefZ Name, bool IsLocal, uint8_t StOther, uint8_t Type, - uint64_t Value, uint64_t Size, SectionBase *Section) - : Defined(DefinedRegularKind, Name, IsLocal, StOther, Type), Value(Value), + Defined(StringRefZ Name, bool IsLocal, uint8_t StOther, uint8_t Type, + uint64_t Value, uint64_t Size, SectionBase *Section) + : Symbol(DefinedKind, Name, IsLocal, StOther, Type), Value(Value), Size(Size), Section(Section) {} // Return true if the symbol is a PIC function. template bool isMipsPIC() const; - static bool classof(const Symbol *S) { - return S->kind() == DefinedRegularKind; - } + static bool classof(const Symbol *S) { return S->isDefined(); } uint64_t Value; uint64_t Size; @@ -323,39 +308,39 @@ }; // Some linker-generated symbols need to be created as -// DefinedRegular symbols. +// Defined symbols. struct ElfSym { // __bss_start - static DefinedRegular *Bss; + static Defined *Bss; // etext and _etext - static DefinedRegular *Etext1; - static DefinedRegular *Etext2; + static Defined *Etext1; + static Defined *Etext2; // edata and _edata - static DefinedRegular *Edata1; - static DefinedRegular *Edata2; + static Defined *Edata1; + static Defined *Edata2; // end and _end - static DefinedRegular *End1; - static DefinedRegular *End2; + static Defined *End1; + static Defined *End2; // The _GLOBAL_OFFSET_TABLE_ symbol is defined by target convention to // be at some offset from the base of the .got section, usually 0 or // the end of the .got. - static DefinedRegular *GlobalOffsetTable; + static Defined *GlobalOffsetTable; // _gp, _gp_disp and __gnu_local_gp symbols. Only for MIPS. - static DefinedRegular *MipsGp; - static DefinedRegular *MipsGpDisp; - static DefinedRegular *MipsLocalGp; + static Defined *MipsGp; + static Defined *MipsGpDisp; + static Defined *MipsLocalGp; }; // A buffer class that is large enough to hold any Symbol-derived // object. We allocate memory using this class and instantiate a symbol // using the placement new. union SymbolUnion { - alignas(DefinedRegular) char A[sizeof(DefinedRegular)]; + alignas(Defined) char A[sizeof(Defined)]; alignas(Undefined) char C[sizeof(Undefined)]; alignas(SharedSymbol) char D[sizeof(SharedSymbol)]; alignas(LazyArchive) char E[sizeof(LazyArchive)]; Index: lld/trunk/ELF/Symbols.cpp =================================================================== --- lld/trunk/ELF/Symbols.cpp +++ lld/trunk/ELF/Symbols.cpp @@ -28,22 +28,22 @@ using namespace lld; using namespace lld::elf; -DefinedRegular *ElfSym::Bss; -DefinedRegular *ElfSym::Etext1; -DefinedRegular *ElfSym::Etext2; -DefinedRegular *ElfSym::Edata1; -DefinedRegular *ElfSym::Edata2; -DefinedRegular *ElfSym::End1; -DefinedRegular *ElfSym::End2; -DefinedRegular *ElfSym::GlobalOffsetTable; -DefinedRegular *ElfSym::MipsGp; -DefinedRegular *ElfSym::MipsGpDisp; -DefinedRegular *ElfSym::MipsLocalGp; +Defined *ElfSym::Bss; +Defined *ElfSym::Etext1; +Defined *ElfSym::Etext2; +Defined *ElfSym::Edata1; +Defined *ElfSym::Edata2; +Defined *ElfSym::End1; +Defined *ElfSym::End2; +Defined *ElfSym::GlobalOffsetTable; +Defined *ElfSym::MipsGp; +Defined *ElfSym::MipsGpDisp; +Defined *ElfSym::MipsLocalGp; static uint64_t getSymVA(const Symbol &Sym, int64_t &Addend) { switch (Sym.kind()) { - case Symbol::DefinedRegularKind: { - auto &D = cast(Sym); + case Symbol::DefinedKind: { + auto &D = cast(Sym); SectionBase *IS = D.Section; if (auto *ISB = dyn_cast_or_null(IS)) IS = ISB->Repl; @@ -125,7 +125,7 @@ InputFile *Symbol::getFile() const { if (isLocal()) { - const SectionBase *Sec = cast(this)->Section; + const SectionBase *Sec = cast(this)->Section; // Local absolute symbols actually have a file, but that is not currently // used. We could support that by having a mostly redundant InputFile in // Symbol, or having a special absolute section if needed. @@ -180,7 +180,7 @@ } uint64_t Symbol::getSize() const { - if (const auto *DR = dyn_cast(this)) + if (const auto *DR = dyn_cast(this)) return DR->Size; if (const auto *S = dyn_cast(this)) return S->Size; @@ -188,7 +188,7 @@ } OutputSection *Symbol::getOutputSection() const { - if (auto *S = dyn_cast(this)) { + if (auto *S = dyn_cast(this)) { if (S->Section) return S->Section->getOutputSection(); return nullptr; @@ -247,7 +247,7 @@ Verstr); } -template bool DefinedRegular::isMipsPIC() const { +template bool Defined::isMipsPIC() const { typedef typename ELFT::Ehdr Elf_Ehdr; if (!Section || !isFunc()) return false; @@ -315,7 +315,7 @@ S = ": lazy definition of "; else if (Sym->isShared()) S = ": shared definition of "; - else if (dyn_cast_or_null(cast(Sym)->Section)) + else if (dyn_cast_or_null(cast(Sym)->Section)) S = ": common definition of "; else S = ": definition of "; @@ -331,7 +331,7 @@ return B.getName(); } -template bool DefinedRegular::template isMipsPIC() const; -template bool DefinedRegular::template isMipsPIC() const; -template bool DefinedRegular::template isMipsPIC() const; -template bool DefinedRegular::template isMipsPIC() const; +template bool Defined::template isMipsPIC() const; +template bool Defined::template isMipsPIC() const; +template bool Defined::template isMipsPIC() const; +template bool Defined::template isMipsPIC() const; Index: lld/trunk/ELF/SyntheticSections.cpp =================================================================== --- lld/trunk/ELF/SyntheticSections.cpp +++ lld/trunk/ELF/SyntheticSections.cpp @@ -275,8 +275,8 @@ Symbol *elf::addSyntheticLocal(StringRef Name, uint8_t Type, uint64_t Value, uint64_t Size, InputSectionBase *Section) { - auto *S = make(Name, /*IsLocal*/ true, STV_DEFAULT, Type, - Value, Size, Section); + auto *S = make(Name, /*IsLocal*/ true, STV_DEFAULT, Type, Value, + Size, Section); if (InX::SymTab) InX::SymTab->addSymbol(S); return S; @@ -428,7 +428,7 @@ Symbol &B = Sec->template getFile()->getRelocTargetSym(Rel); // FDEs for garbage-collected or merged-by-ICF sections are dead. - if (auto *D = dyn_cast(&B)) + if (auto *D = dyn_cast(&B)) if (auto *Sec = cast_or_null(D->Section)) return Sec->Live && (Sec == Sec->Repl); return false; @@ -1576,13 +1576,13 @@ // Set a section index. BssSection *CommonSec = nullptr; if (!Config->DefineCommon) - if (auto *D = dyn_cast(Sym)) + if (auto *D = dyn_cast(Sym)) CommonSec = dyn_cast_or_null(D->Section); if (CommonSec) ESym->st_shndx = SHN_COMMON; else if (const OutputSection *OutSec = Sym->getOutputSection()) ESym->st_shndx = OutSec->SectionIndex; - else if (isa(Sym)) + else if (isa(Sym)) ESym->st_shndx = SHN_ABS; else ESym->st_shndx = SHN_UNDEF; @@ -1621,7 +1621,7 @@ ESym->st_other |= STO_MIPS_PLT; if (Config->Relocatable) - if (auto *D = dyn_cast(Sym)) + if (auto *D = dyn_cast(Sym)) if (D->isMipsPIC()) ESym->st_other |= STO_MIPS_PIC; ++ESym; Index: lld/trunk/ELF/Thunks.h =================================================================== --- lld/trunk/ELF/Thunks.h +++ lld/trunk/ELF/Thunks.h @@ -23,7 +23,7 @@ // include transferring control from non-pi to pi and changing state on // targets like ARM. // -// Thunks can be created for DefinedRegular, Shared and Undefined Symbols. +// Thunks can be created for Defined, Shared and Undefined Symbols. // Thunks are assigned to synthetic ThunkSections class Thunk { public: Index: lld/trunk/ELF/Thunks.cpp =================================================================== --- lld/trunk/ELF/Thunks.cpp +++ lld/trunk/ELF/Thunks.cpp @@ -251,7 +251,7 @@ } InputSection *MipsThunk::getTargetInputSection() const { - auto *DR = dyn_cast(&Destination); + auto *DR = dyn_cast(&Destination); return dyn_cast(DR->Section); } @@ -276,7 +276,7 @@ } InputSection *MicroMipsThunk::getTargetInputSection() const { - auto *DR = dyn_cast(&Destination); + auto *DR = dyn_cast(&Destination); return dyn_cast(DR->Section); } @@ -301,7 +301,7 @@ } InputSection *MicroMipsR6Thunk::getTargetInputSection() const { - auto *DR = dyn_cast(&Destination); + auto *DR = dyn_cast(&Destination); return dyn_cast(DR->Section); } Index: lld/trunk/ELF/Writer.cpp =================================================================== --- lld/trunk/ELF/Writer.cpp +++ lld/trunk/ELF/Writer.cpp @@ -426,7 +426,7 @@ if (!B.isLocal() && !B.IsUsedInRegularObj) return false; - if (auto *D = dyn_cast(&B)) { + if (auto *D = dyn_cast(&B)) { // Always include absolute symbols. SectionBase *Sec = D->Section; if (!Sec) @@ -456,7 +456,7 @@ if (!B->isLocal()) fatal(toString(F) + ": broken object: getLocalSymbols returns a non-local symbol"); - auto *DR = dyn_cast(B); + auto *DR = dyn_cast(B); // No reason to keep local undefined symbol in symtab. if (!DR) @@ -491,9 +491,8 @@ IS->Type == SHT_RELA) continue; - auto *Sym = - make("", /*IsLocal=*/true, /*StOther=*/0, STT_SECTION, - /*Value=*/0, /*Size=*/0, IS); + auto *Sym = make("", /*IsLocal=*/true, /*StOther=*/0, STT_SECTION, + /*Value=*/0, /*Size=*/0, IS); InX::SymTab->addSymbol(Sym); } } @@ -735,16 +734,16 @@ } template -static DefinedRegular * -addOptionalRegular(StringRef Name, SectionBase *Sec, uint64_t Val, - uint8_t StOther = STV_HIDDEN, uint8_t Binding = STB_GLOBAL) { +static Defined *addOptionalRegular(StringRef Name, SectionBase *Sec, + uint64_t Val, uint8_t StOther = STV_HIDDEN, + uint8_t Binding = STB_GLOBAL) { Symbol *S = Symtab->find(Name); if (!S || S->isInCurrentOutput()) return nullptr; Symbol *Sym = Symtab->addRegular(Name, StOther, STT_NOTYPE, Val, /*Size=*/0, Binding, Sec, /*File=*/nullptr); - return cast(Sym); + return cast(Sym); } // The beginning and the ending of .rel[a].plt section are marked