Rename ObjectFile -> ObjFile.

Rename it because it was too easy to conflict with llvm::object::ObjectFile
which broke buildbots several times.

llvm-svn: 309199
This commit is contained in:
Rui Ueyama 2017-07-26 22:13:32 +00:00
parent fa83d5a398
commit 709fb2bb10
18 changed files with 115 additions and 122 deletions

View File

@ -283,7 +283,7 @@ static uint32_t getArchFlags(ArrayRef<FileFlags> Files) {
template <class ELFT> uint32_t elf::getMipsEFlags() {
std::vector<FileFlags> V;
for (elf::ObjectFile<ELFT> *F : ObjectFile<ELFT>::Instances)
for (ObjFile<ELFT> *F : ObjFile<ELFT>::Instances)
V.push_back({F->getName(), F->getObj().getHeader()->e_flags});
if (V.empty())
return 0;

View File

@ -188,7 +188,7 @@ void LinkerDriver::addFile(StringRef Path, bool WithLOption) {
// we'll handle it as if it had a symbol table.
if (!File->isEmpty() && !File->hasSymbolTable()) {
for (const auto &P : getArchiveMembers(MBRef))
Files.push_back(make<LazyObjectFile>(P.first, Path, P.second));
Files.push_back(make<LazyObjFile>(P.first, Path, P.second));
return;
}
@ -217,7 +217,7 @@ void LinkerDriver::addFile(StringRef Path, bool WithLOption) {
return;
default:
if (InLib)
Files.push_back(make<LazyObjectFile>(MBRef, "", 0));
Files.push_back(make<LazyObjFile>(MBRef, "", 0));
else
Files.push_back(createObjectFile(MBRef));
}
@ -1031,7 +1031,7 @@ template <class ELFT> void LinkerDriver::link(opt::InputArgList &Args) {
// Now that we have a complete list of input files.
// Beyond this point, no new files are added.
// Aggregate all input sections into one place.
for (elf::ObjectFile<ELFT> *F : ObjectFile<ELFT>::Instances)
for (ObjFile<ELFT> *F : ObjFile<ELFT>::Instances)
for (InputSectionBase *S : F->getSections())
if (S && S != &InputSection::Discarded)
InputSections.push_back(S);

View File

@ -49,7 +49,7 @@ void GdbHashTab::finalizeContents() {
}
template <class ELFT>
LLDDwarfObj<ELFT>::LLDDwarfObj(elf::ObjectFile<ELFT> *Obj) : Obj(Obj) {
LLDDwarfObj<ELFT>::LLDDwarfObj(ObjFile<ELFT> *Obj) : Obj(Obj) {
for (InputSectionBase *Sec : Obj->getSections()) {
if (!Sec)
continue;
@ -84,7 +84,7 @@ LLDDwarfObj<ELFT>::findAux(const InputSectionBase &Sec, uint64_t Pos,
if (I == Rels.end())
return None;
const RelTy &Rel = *I;
const elf::ObjectFile<ELFT> *File = Sec.getFile<ELFT>();
const ObjFile<ELFT> *File = Sec.getFile<ELFT>();
uint32_t SymIndex = Rel.getSymbol(Config->IsMips64EL);
const typename ELFT::Sym &Sym = File->getELFSymbols()[SymIndex];
uint32_t SecIndex = File->getSectionIndex(Sym);

View File

@ -24,7 +24,7 @@ struct LLDDWARFSection final : public llvm::DWARFSection {
};
template <class ELFT> class LLDDwarfObj final : public llvm::DWARFObject {
elf::ObjectFile<ELFT> *Obj;
ObjFile<ELFT> *Obj;
LLDDWARFSection InfoSection;
LLDDWARFSection RangeSection;
LLDDWARFSection LineSection;
@ -38,7 +38,7 @@ template <class ELFT> class LLDDwarfObj final : public llvm::DWARFObject {
ArrayRef<RelTy> Rels) const;
public:
explicit LLDDwarfObj(elf::ObjectFile<ELFT> *Obj);
explicit LLDDwarfObj(ObjFile<ELFT> *Obj);
const llvm::DWARFSection &getInfoSection() const override {
return InfoSection;
}

View File

@ -62,7 +62,7 @@ Optional<MemoryBufferRef> elf::readFile(StringRef Path) {
return MBRef;
}
template <class ELFT> void elf::ObjectFile<ELFT>::initializeDwarfLine() {
template <class ELFT> void ObjFile<ELFT>::initializeDwarfLine() {
DWARFContext Dwarf(make_unique<LLDDwarfObj<ELFT>>(this));
const DWARFObject &Obj = Dwarf.getDWARFObj();
DwarfLine.reset(new DWARFDebugLine);
@ -78,8 +78,8 @@ template <class ELFT> void elf::ObjectFile<ELFT>::initializeDwarfLine() {
// Returns source line information for a given offset
// using DWARF debug info.
template <class ELFT>
Optional<DILineInfo> elf::ObjectFile<ELFT>::getDILineInfo(InputSectionBase *S,
uint64_t Offset) {
Optional<DILineInfo> ObjFile<ELFT>::getDILineInfo(InputSectionBase *S,
uint64_t Offset) {
llvm::call_once(InitDwarfLine, [this]() { initializeDwarfLine(); });
// The offset to CU is 0.
@ -101,8 +101,7 @@ Optional<DILineInfo> elf::ObjectFile<ELFT>::getDILineInfo(InputSectionBase *S,
// Returns source line information for a given offset
// using DWARF debug info.
template <class ELFT>
std::string elf::ObjectFile<ELFT>::getLineInfo(InputSectionBase *S,
uint64_t Offset) {
std::string ObjFile<ELFT>::getLineInfo(InputSectionBase *S, uint64_t Offset) {
if (Optional<DILineInfo> Info = getDILineInfo(S, Offset))
return Info->FileName + ":" + std::to_string(Info->Line);
return "";
@ -157,27 +156,25 @@ void ELFFileBase<ELFT>::initSymtab(ArrayRef<Elf_Shdr> Sections,
}
template <class ELFT>
elf::ObjectFile<ELFT>::ObjectFile(MemoryBufferRef M, StringRef ArchiveName)
ObjFile<ELFT>::ObjFile(MemoryBufferRef M, StringRef ArchiveName)
: ELFFileBase<ELFT>(Base::ObjectKind, M) {
this->ArchiveName = ArchiveName;
}
template <class ELFT>
ArrayRef<SymbolBody *> elf::ObjectFile<ELFT>::getLocalSymbols() {
template <class ELFT> ArrayRef<SymbolBody *> ObjFile<ELFT>::getLocalSymbols() {
if (this->SymbolBodies.empty())
return this->SymbolBodies;
return makeArrayRef(this->SymbolBodies).slice(1, this->FirstNonLocal - 1);
}
template <class ELFT>
ArrayRef<SymbolBody *> elf::ObjectFile<ELFT>::getSymbols() {
template <class ELFT> ArrayRef<SymbolBody *> ObjFile<ELFT>::getSymbols() {
if (this->SymbolBodies.empty())
return this->SymbolBodies;
return makeArrayRef(this->SymbolBodies).slice(1);
}
template <class ELFT>
void elf::ObjectFile<ELFT>::parse(DenseSet<CachedHashStringRef> &ComdatGroups) {
void ObjFile<ELFT>::parse(DenseSet<CachedHashStringRef> &ComdatGroups) {
// Read section and symbol tables.
initializeSections(ComdatGroups);
initializeSymbols();
@ -187,9 +184,8 @@ void elf::ObjectFile<ELFT>::parse(DenseSet<CachedHashStringRef> &ComdatGroups) {
// They are identified and deduplicated by group name. This function
// returns a group name.
template <class ELFT>
StringRef
elf::ObjectFile<ELFT>::getShtGroupSignature(ArrayRef<Elf_Shdr> Sections,
const Elf_Shdr &Sec) {
StringRef ObjFile<ELFT>::getShtGroupSignature(ArrayRef<Elf_Shdr> Sections,
const Elf_Shdr &Sec) {
// Group signatures are stored as symbol names in object files.
// sh_info contains a symbol index, so we fetch a symbol and read its name.
if (this->Symbols.empty())
@ -214,8 +210,8 @@ elf::ObjectFile<ELFT>::getShtGroupSignature(ArrayRef<Elf_Shdr> Sections,
}
template <class ELFT>
ArrayRef<typename elf::ObjectFile<ELFT>::Elf_Word>
elf::ObjectFile<ELFT>::getShtGroupEntries(const Elf_Shdr &Sec) {
ArrayRef<typename ObjFile<ELFT>::Elf_Word>
ObjFile<ELFT>::getShtGroupEntries(const Elf_Shdr &Sec) {
const ELFFile<ELFT> &Obj = this->getObj();
ArrayRef<Elf_Word> Entries = check(
Obj.template getSectionContentsAsArray<Elf_Word>(&Sec), toString(this));
@ -224,8 +220,7 @@ elf::ObjectFile<ELFT>::getShtGroupEntries(const Elf_Shdr &Sec) {
return Entries.slice(1);
}
template <class ELFT>
bool elf::ObjectFile<ELFT>::shouldMerge(const Elf_Shdr &Sec) {
template <class ELFT> bool ObjFile<ELFT>::shouldMerge(const Elf_Shdr &Sec) {
// We don't merge sections if -O0 (default is -O1). This makes sometimes
// the linker significantly faster, although the output will be bigger.
if (Config->Optimize == 0)
@ -278,7 +273,7 @@ bool elf::ObjectFile<ELFT>::shouldMerge(const Elf_Shdr &Sec) {
}
template <class ELFT>
void elf::ObjectFile<ELFT>::initializeSections(
void ObjFile<ELFT>::initializeSections(
DenseSet<CachedHashStringRef> &ComdatGroups) {
const ELFFile<ELFT> &Obj = this->getObj();
@ -356,7 +351,7 @@ void elf::ObjectFile<ELFT>::initializeSections(
}
template <class ELFT>
InputSectionBase *elf::ObjectFile<ELFT>::getRelocTarget(const Elf_Shdr &Sec) {
InputSectionBase *ObjFile<ELFT>::getRelocTarget(const Elf_Shdr &Sec) {
uint32_t Idx = Sec.sh_info;
if (Idx >= this->Sections.size())
fatal(toString(this) + ": invalid relocated section index: " + Twine(Idx));
@ -383,8 +378,7 @@ InputSectionBase *toRegularSection(MergeInputSection *Sec) {
}
template <class ELFT>
InputSectionBase *
elf::ObjectFile<ELFT>::createInputSection(const Elf_Shdr &Sec) {
InputSectionBase *ObjFile<ELFT>::createInputSection(const Elf_Shdr &Sec) {
StringRef Name = getSectionName(Sec);
switch (Sec.sh_type) {
@ -523,19 +517,19 @@ elf::ObjectFile<ELFT>::createInputSection(const Elf_Shdr &Sec) {
}
template <class ELFT>
StringRef elf::ObjectFile<ELFT>::getSectionName(const Elf_Shdr &Sec) {
StringRef ObjFile<ELFT>::getSectionName(const Elf_Shdr &Sec) {
return check(this->getObj().getSectionName(&Sec, SectionStringTable),
toString(this));
}
template <class ELFT> void elf::ObjectFile<ELFT>::initializeSymbols() {
template <class ELFT> void ObjFile<ELFT>::initializeSymbols() {
SymbolBodies.reserve(this->Symbols.size());
for (const Elf_Sym &Sym : this->Symbols)
SymbolBodies.push_back(createSymbolBody(&Sym));
}
template <class ELFT>
InputSectionBase *elf::ObjectFile<ELFT>::getSection(const Elf_Sym &Sym) const {
InputSectionBase *ObjFile<ELFT>::getSection(const Elf_Sym &Sym) const {
uint32_t Index = this->getSectionIndex(Sym);
if (Index >= this->Sections.size())
fatal(toString(this) + ": invalid section index: " + Twine(Index));
@ -559,7 +553,7 @@ InputSectionBase *elf::ObjectFile<ELFT>::getSection(const Elf_Sym &Sym) const {
}
template <class ELFT>
SymbolBody *elf::ObjectFile<ELFT>::createSymbolBody(const Elf_Sym *Sym) {
SymbolBody *ObjFile<ELFT>::createSymbolBody(const Elf_Sym *Sym) {
int Binding = Sym->getBinding();
InputSectionBase *Sec = getSection(*Sym);
@ -965,13 +959,13 @@ InputFile *elf::createObjectFile(MemoryBufferRef MB, StringRef ArchiveName,
switch (getELFKind(MB)) {
case ELF32LEKind:
return make<ObjectFile<ELF32LE>>(MB, ArchiveName);
return make<ObjFile<ELF32LE>>(MB, ArchiveName);
case ELF32BEKind:
return make<ObjectFile<ELF32BE>>(MB, ArchiveName);
return make<ObjFile<ELF32BE>>(MB, ArchiveName);
case ELF64LEKind:
return make<ObjectFile<ELF64LE>>(MB, ArchiveName);
return make<ObjFile<ELF64LE>>(MB, ArchiveName);
case ELF64BEKind:
return make<ObjectFile<ELF64BE>>(MB, ArchiveName);
return make<ObjFile<ELF64BE>>(MB, ArchiveName);
default:
llvm_unreachable("getELFKind");
}
@ -992,26 +986,26 @@ InputFile *elf::createSharedFile(MemoryBufferRef MB, StringRef DefaultSoName) {
}
}
MemoryBufferRef LazyObjectFile::getBuffer() {
MemoryBufferRef LazyObjFile::getBuffer() {
if (Seen)
return MemoryBufferRef();
Seen = true;
return MB;
}
InputFile *LazyObjectFile::fetch() {
InputFile *LazyObjFile::fetch() {
MemoryBufferRef MBRef = getBuffer();
if (MBRef.getBuffer().empty())
return nullptr;
return createObjectFile(MBRef, ArchiveName, OffsetInArchive);
}
template <class ELFT> void LazyObjectFile::parse() {
template <class ELFT> void LazyObjFile::parse() {
for (StringRef Sym : getSymbols())
Symtab->addLazyObject<ELFT>(Sym, *this);
}
template <class ELFT> std::vector<StringRef> LazyObjectFile::getElfSymbols() {
template <class ELFT> std::vector<StringRef> LazyObjFile::getElfSymbols() {
typedef typename ELFT::Shdr Elf_Shdr;
typedef typename ELFT::Sym Elf_Sym;
typedef typename ELFT::SymRange Elf_Sym_Range;
@ -1036,7 +1030,7 @@ template <class ELFT> std::vector<StringRef> LazyObjectFile::getElfSymbols() {
return {};
}
std::vector<StringRef> LazyObjectFile::getBitcodeSymbols() {
std::vector<StringRef> LazyObjFile::getBitcodeSymbols() {
std::unique_ptr<lto::InputFile> Obj =
check(lto::InputFile::create(this->MB), toString(this));
std::vector<StringRef> V;
@ -1047,7 +1041,7 @@ std::vector<StringRef> LazyObjectFile::getBitcodeSymbols() {
}
// Returns a vector of globally-visible defined symbol names.
std::vector<StringRef> LazyObjectFile::getSymbols() {
std::vector<StringRef> LazyObjFile::getSymbols() {
if (isBitcode(this->MB))
return getBitcodeSymbols();
@ -1075,20 +1069,20 @@ template void BitcodeFile::parse<ELF32BE>(DenseSet<CachedHashStringRef> &);
template void BitcodeFile::parse<ELF64LE>(DenseSet<CachedHashStringRef> &);
template void BitcodeFile::parse<ELF64BE>(DenseSet<CachedHashStringRef> &);
template void LazyObjectFile::parse<ELF32LE>();
template void LazyObjectFile::parse<ELF32BE>();
template void LazyObjectFile::parse<ELF64LE>();
template void LazyObjectFile::parse<ELF64BE>();
template void LazyObjFile::parse<ELF32LE>();
template void LazyObjFile::parse<ELF32BE>();
template void LazyObjFile::parse<ELF64LE>();
template void LazyObjFile::parse<ELF64BE>();
template class elf::ELFFileBase<ELF32LE>;
template class elf::ELFFileBase<ELF32BE>;
template class elf::ELFFileBase<ELF64LE>;
template class elf::ELFFileBase<ELF64BE>;
template class elf::ObjectFile<ELF32LE>;
template class elf::ObjectFile<ELF32BE>;
template class elf::ObjectFile<ELF64LE>;
template class elf::ObjectFile<ELF64BE>;
template class elf::ObjFile<ELF32LE>;
template class elf::ObjFile<ELF32BE>;
template class elf::ObjFile<ELF64LE>;
template class elf::ObjFile<ELF64BE>;
template class elf::SharedFile<ELF32LE>;
template class elf::SharedFile<ELF32BE>;

View File

@ -138,7 +138,7 @@ protected:
};
// .o file.
template <class ELFT> class ObjectFile : public ELFFileBase<ELFT> {
template <class ELFT> class ObjFile : public ELFFileBase<ELFT> {
typedef ELFFileBase<ELFT> Base;
typedef typename ELFT::Rel Elf_Rel;
typedef typename ELFT::Rela Elf_Rela;
@ -155,12 +155,12 @@ public:
return F->kind() == Base::ObjectKind;
}
static std::vector<ObjectFile<ELFT> *> Instances;
static std::vector<ObjFile<ELFT> *> Instances;
ArrayRef<SymbolBody *> getSymbols();
ArrayRef<SymbolBody *> getLocalSymbols();
ObjectFile(MemoryBufferRef M, StringRef ArchiveName);
ObjFile(MemoryBufferRef M, StringRef ArchiveName);
void parse(llvm::DenseSet<llvm::CachedHashStringRef> &ComdatGroups);
InputSectionBase *getSection(const Elf_Sym &Sym) const;
@ -218,20 +218,19 @@ private:
llvm::once_flag InitDwarfLine;
};
template <class ELFT>
std::vector<ObjectFile<ELFT> *> ObjectFile<ELFT>::Instances;
template <class ELFT> std::vector<ObjFile<ELFT> *> ObjFile<ELFT>::Instances;
// LazyObjectFile is analogous to ArchiveFile in the sense that
// LazyObjFile is analogous to ArchiveFile in the sense that
// the file contains lazy symbols. The difference is that
// LazyObjectFile wraps a single file instead of multiple files.
// LazyObjFile wraps a single file instead of multiple files.
//
// This class is used for --start-lib and --end-lib options which
// instruct the linker to link object files between them with the
// archive file semantics.
class LazyObjectFile : public InputFile {
class LazyObjFile : public InputFile {
public:
LazyObjectFile(MemoryBufferRef M, StringRef ArchiveName,
uint64_t OffsetInArchive)
LazyObjFile(MemoryBufferRef M, StringRef ArchiveName,
uint64_t OffsetInArchive)
: InputFile(LazyObjectKind, M), OffsetInArchive(OffsetInArchive) {
this->ArchiveName = ArchiveName;
}

View File

@ -45,7 +45,7 @@ std::string lld::toString(const InputSectionBase *Sec) {
}
template <class ELFT>
static ArrayRef<uint8_t> getSectionContents(elf::ObjectFile<ELFT> *File,
static ArrayRef<uint8_t> getSectionContents(ObjFile<ELFT> *File,
const typename ELFT::Shdr *Hdr) {
if (!File || Hdr->sh_type == SHT_NOBITS)
return makeArrayRef<uint8_t>(nullptr, Hdr->sh_size);
@ -102,7 +102,7 @@ static uint64_t getType(uint64_t Type, StringRef Name) {
}
template <class ELFT>
InputSectionBase::InputSectionBase(elf::ObjectFile<ELFT> *File,
InputSectionBase::InputSectionBase(ObjFile<ELFT> *File,
const typename ELFT::Shdr *Hdr,
StringRef Name, Kind SectionKind)
: InputSectionBase(File, getFlags(Hdr->sh_flags),
@ -246,7 +246,7 @@ std::string InputSectionBase::getLocation(uint64_t Offset) {
// Returns an empty string if there's no way to get line info.
template <class ELFT> std::string InputSectionBase::getSrcMsg(uint64_t Offset) {
// Synthetic sections don't have input files.
elf::ObjectFile<ELFT> *File = getFile<ELFT>();
ObjFile<ELFT> *File = getFile<ELFT>();
if (!File)
return "";
@ -275,7 +275,7 @@ template <class ELFT> std::string InputSectionBase::getSrcMsg(uint64_t Offset) {
// path/to/foo.o:(function bar) in archive path/to/bar.a
template <class ELFT> std::string InputSectionBase::getObjMsg(uint64_t Off) {
// Synthetic sections don't have input files.
elf::ObjectFile<ELFT> *File = getFile<ELFT>();
ObjFile<ELFT> *File = getFile<ELFT>();
if (!File)
return ("(internal):(" + Name + "+0x" + utohexstr(Off) + ")").str();
std::string Filename = File->getName();
@ -304,8 +304,8 @@ InputSection::InputSection(uint64_t Flags, uint32_t Type, uint32_t Alignment,
Name, K) {}
template <class ELFT>
InputSection::InputSection(elf::ObjectFile<ELFT> *F,
const typename ELFT::Shdr *Header, StringRef Name)
InputSection::InputSection(ObjFile<ELFT> *F, const typename ELFT::Shdr *Header,
StringRef Name)
: InputSectionBase(F, Header, Name, InputSectionBase::Regular) {}
bool InputSection::classof(const SectionBase *S) {
@ -663,8 +663,8 @@ void InputSection::relocateNonAlloc(uint8_t *Buf, ArrayRef<RelTy> Rels) {
}
}
template <class ELFT> elf::ObjectFile<ELFT> *InputSectionBase::getFile() const {
return cast_or_null<elf::ObjectFile<ELFT>>(File);
template <class ELFT> ObjFile<ELFT> *InputSectionBase::getFile() const {
return cast_or_null<ObjFile<ELFT>>(File);
}
template <class ELFT>
@ -776,7 +776,7 @@ void InputSection::replace(InputSection *Other) {
}
template <class ELFT>
EhInputSection::EhInputSection(elf::ObjectFile<ELFT> *F,
EhInputSection::EhInputSection(ObjFile<ELFT> *F,
const typename ELFT::Shdr *Header,
StringRef Name)
: InputSectionBase(F, Header, Name, InputSectionBase::EHFrame) {
@ -893,7 +893,7 @@ void MergeInputSection::splitNonStrings(ArrayRef<uint8_t> Data,
}
template <class ELFT>
MergeInputSection::MergeInputSection(elf::ObjectFile<ELFT> *F,
MergeInputSection::MergeInputSection(ObjFile<ELFT> *F,
const typename ELFT::Shdr *Header,
StringRef Name)
: InputSectionBase(F, Header, Name, InputSectionBase::Merge) {}
@ -982,14 +982,14 @@ uint64_t MergeInputSection::getOffset(uint64_t Offset) const {
return Piece.OutputOff + Addend;
}
template InputSection::InputSection(elf::ObjectFile<ELF32LE> *,
const ELF32LE::Shdr *, StringRef);
template InputSection::InputSection(elf::ObjectFile<ELF32BE> *,
const ELF32BE::Shdr *, StringRef);
template InputSection::InputSection(elf::ObjectFile<ELF64LE> *,
const ELF64LE::Shdr *, StringRef);
template InputSection::InputSection(elf::ObjectFile<ELF64BE> *,
const ELF64BE::Shdr *, StringRef);
template InputSection::InputSection(ObjFile<ELF32LE> *, const ELF32LE::Shdr *,
StringRef);
template InputSection::InputSection(ObjFile<ELF32BE> *, const ELF32BE::Shdr *,
StringRef);
template InputSection::InputSection(ObjFile<ELF64LE> *, const ELF64LE::Shdr *,
StringRef);
template InputSection::InputSection(ObjFile<ELF64BE> *, const ELF64BE::Shdr *,
StringRef);
template std::string InputSectionBase::getLocation<ELF32LE>(uint64_t);
template std::string InputSectionBase::getLocation<ELF32BE>(uint64_t);
@ -1011,27 +1011,27 @@ template void InputSection::writeTo<ELF32BE>(uint8_t *);
template void InputSection::writeTo<ELF64LE>(uint8_t *);
template void InputSection::writeTo<ELF64BE>(uint8_t *);
template elf::ObjectFile<ELF32LE> *InputSectionBase::getFile<ELF32LE>() const;
template elf::ObjectFile<ELF32BE> *InputSectionBase::getFile<ELF32BE>() const;
template elf::ObjectFile<ELF64LE> *InputSectionBase::getFile<ELF64LE>() const;
template elf::ObjectFile<ELF64BE> *InputSectionBase::getFile<ELF64BE>() const;
template ObjFile<ELF32LE> *InputSectionBase::getFile<ELF32LE>() const;
template ObjFile<ELF32BE> *InputSectionBase::getFile<ELF32BE>() const;
template ObjFile<ELF64LE> *InputSectionBase::getFile<ELF64LE>() const;
template ObjFile<ELF64BE> *InputSectionBase::getFile<ELF64BE>() const;
template MergeInputSection::MergeInputSection(elf::ObjectFile<ELF32LE> *,
template MergeInputSection::MergeInputSection(ObjFile<ELF32LE> *,
const ELF32LE::Shdr *, StringRef);
template MergeInputSection::MergeInputSection(elf::ObjectFile<ELF32BE> *,
template MergeInputSection::MergeInputSection(ObjFile<ELF32BE> *,
const ELF32BE::Shdr *, StringRef);
template MergeInputSection::MergeInputSection(elf::ObjectFile<ELF64LE> *,
template MergeInputSection::MergeInputSection(ObjFile<ELF64LE> *,
const ELF64LE::Shdr *, StringRef);
template MergeInputSection::MergeInputSection(elf::ObjectFile<ELF64BE> *,
template MergeInputSection::MergeInputSection(ObjFile<ELF64BE> *,
const ELF64BE::Shdr *, StringRef);
template EhInputSection::EhInputSection(elf::ObjectFile<ELF32LE> *,
template EhInputSection::EhInputSection(ObjFile<ELF32LE> *,
const ELF32LE::Shdr *, StringRef);
template EhInputSection::EhInputSection(elf::ObjectFile<ELF32BE> *,
template EhInputSection::EhInputSection(ObjFile<ELF32BE> *,
const ELF32BE::Shdr *, StringRef);
template EhInputSection::EhInputSection(elf::ObjectFile<ELF64LE> *,
template EhInputSection::EhInputSection(ObjFile<ELF64LE> *,
const ELF64LE::Shdr *, StringRef);
template EhInputSection::EhInputSection(elf::ObjectFile<ELF64BE> *,
template EhInputSection::EhInputSection(ObjFile<ELF64BE> *,
const ELF64BE::Shdr *, StringRef);
template void EhInputSection::split<ELF32LE>();

View File

@ -32,7 +32,7 @@ class DefinedRegular;
class SyntheticSection;
template <class ELFT> class EhFrameSection;
class MergeSyntheticSection;
template <class ELFT> class ObjectFile;
template <class ELFT> class ObjFile;
class OutputSection;
// This is the base class of all sections that lld handles. Some are sections in
@ -113,7 +113,7 @@ public:
}
template <class ELFT>
InputSectionBase(ObjectFile<ELFT> *File, const typename ELFT::Shdr *Header,
InputSectionBase(ObjFile<ELFT> *File, const typename ELFT::Shdr *Header,
StringRef Name, Kind SectionKind);
InputSectionBase(InputFile *File, uint64_t Flags, uint32_t Type,
@ -157,7 +157,7 @@ public:
// Returns the size of this section (even if this is a common or BSS.)
size_t getSize() const;
template <class ELFT> ObjectFile<ELFT> *getFile() const;
template <class ELFT> ObjFile<ELFT> *getFile() const;
template <class ELFT> llvm::object::ELFFile<ELFT> getObj() const {
return getFile<ELFT>()->getObj();
@ -204,7 +204,7 @@ static_assert(sizeof(SectionPiece) == 2 * sizeof(size_t),
class MergeInputSection : public InputSectionBase {
public:
template <class ELFT>
MergeInputSection(ObjectFile<ELFT> *F, const typename ELFT::Shdr *Header,
MergeInputSection(ObjFile<ELFT> *F, const typename ELFT::Shdr *Header,
StringRef Name);
static bool classof(const SectionBase *S);
void splitIntoPieces();
@ -273,7 +273,7 @@ struct EhSectionPiece : public SectionPiece {
class EhInputSection : public InputSectionBase {
public:
template <class ELFT>
EhInputSection(ObjectFile<ELFT> *F, const typename ELFT::Shdr *Header,
EhInputSection(ObjFile<ELFT> *F, const typename ELFT::Shdr *Header,
StringRef Name);
static bool classof(const SectionBase *S);
template <class ELFT> void split();
@ -295,7 +295,7 @@ public:
InputSection(uint64_t Flags, uint32_t Type, uint32_t Alignment,
ArrayRef<uint8_t> Data, StringRef Name, Kind K = Regular);
template <class ELFT>
InputSection(ObjectFile<ELFT> *F, const typename ELFT::Shdr *Header,
InputSection(ObjFile<ELFT> *F, const typename ELFT::Shdr *Header,
StringRef Name);
// Write this section to a mmap'ed file, assuming Buf is pointing to

View File

@ -1028,7 +1028,7 @@ static void finalizeShtGroup(OutputSection *OS,
// sh_info then contain index of an entry in symbol table section which
// provides signature of the section group.
elf::ObjectFile<ELFT> *Obj = Sections[0]->getFile<ELFT>();
ObjFile<ELFT> *Obj = Sections[0]->getFile<ELFT>();
ArrayRef<SymbolBody *> Symbols = Obj->getSymbols();
OS->Info = InX::SymTab->getSymbolIndex(Symbols[Sections[0]->Info - 1]);
}

View File

@ -51,7 +51,7 @@ static std::string indent(int Depth) { return std::string(Depth * 8, ' '); }
// Returns a list of all symbols that we want to print out.
template <class ELFT> std::vector<DefinedRegular *> getSymbols() {
std::vector<DefinedRegular *> V;
for (elf::ObjectFile<ELFT> *File : elf::ObjectFile<ELFT>::Instances)
for (ObjFile<ELFT> *File : ObjFile<ELFT>::Instances)
for (SymbolBody *B : File->getSymbols())
if (B->File == File && !B->isSection())
if (auto *Sym = dyn_cast<DefinedRegular>(B))

View File

@ -29,7 +29,7 @@ class InputSection;
class InputSectionBase;
class MergeInputSection;
class OutputSection;
template <class ELFT> class ObjectFile;
template <class ELFT> class ObjFile;
template <class ELFT> class SharedFile;
class SharedSymbol;
class DefinedRegular;

View File

@ -74,7 +74,7 @@ template <class ELFT> void SymbolTable::addFile(InputFile *File) {
}
// Lazy object file
if (auto *F = dyn_cast<LazyObjectFile>(File)) {
if (auto *F = dyn_cast<LazyObjFile>(File)) {
F->parse<ELFT>();
return;
}
@ -101,8 +101,8 @@ template <class ELFT> void SymbolTable::addFile(InputFile *File) {
}
// Regular object file
auto *F = cast<ObjectFile<ELFT>>(File);
ObjectFile<ELFT>::Instances.push_back(F);
auto *F = cast<ObjFile<ELFT>>(File);
ObjFile<ELFT>::Instances.push_back(F);
F->parse(ComdatGroups);
}
@ -123,10 +123,10 @@ template <class ELFT> void SymbolTable::addCombinedLTOObject() {
LTO->add(*F);
for (InputFile *File : LTO->compile()) {
ObjectFile<ELFT> *Obj = cast<ObjectFile<ELFT>>(File);
ObjFile<ELFT> *Obj = cast<ObjFile<ELFT>>(File);
DenseSet<CachedHashStringRef> DummyGroups;
Obj->parse(DummyGroups);
ObjectFile<ELFT>::Instances.push_back(Obj);
ObjFile<ELFT>::Instances.push_back(Obj);
}
}
@ -564,7 +564,7 @@ Symbol *SymbolTable::addLazyArchive(ArchiveFile *F,
}
template <class ELFT>
void SymbolTable::addLazyObject(StringRef Name, LazyObjectFile &Obj) {
void SymbolTable::addLazyObject(StringRef Name, LazyObjFile &Obj) {
Symbol *S;
bool WasInserted;
std::tie(S, WasInserted) = insert(Name);
@ -833,10 +833,10 @@ template Symbol *
SymbolTable::addLazyArchive<ELF64BE>(ArchiveFile *,
const object::Archive::Symbol);
template void SymbolTable::addLazyObject<ELF32LE>(StringRef, LazyObjectFile &);
template void SymbolTable::addLazyObject<ELF32BE>(StringRef, LazyObjectFile &);
template void SymbolTable::addLazyObject<ELF64LE>(StringRef, LazyObjectFile &);
template void SymbolTable::addLazyObject<ELF64BE>(StringRef, LazyObjectFile &);
template void SymbolTable::addLazyObject<ELF32LE>(StringRef, LazyObjFile &);
template void SymbolTable::addLazyObject<ELF32BE>(StringRef, LazyObjFile &);
template void SymbolTable::addLazyObject<ELF64LE>(StringRef, LazyObjFile &);
template void SymbolTable::addLazyObject<ELF64BE>(StringRef, LazyObjFile &);
template void SymbolTable::addShared<ELF32LE>(SharedFile<ELF32LE> *, StringRef,
const typename ELF32LE::Sym &,

View File

@ -68,7 +68,7 @@ public:
template <class ELFT>
Symbol *addLazyArchive(ArchiveFile *F, const llvm::object::Archive::Symbol S);
template <class ELFT> void addLazyObject(StringRef Name, LazyObjectFile &Obj);
template <class ELFT> void addLazyObject(StringRef Name, LazyObjFile &Obj);
Symbol *addBitcode(StringRef Name, uint8_t Binding, uint8_t StOther,
uint8_t Type, bool CanOmitFromDynSym, BitcodeFile *File);

View File

@ -325,7 +325,7 @@ LazyArchive::LazyArchive(ArchiveFile &File,
this->File = &File;
}
LazyObject::LazyObject(StringRef Name, LazyObjectFile &File, uint8_t Type)
LazyObject::LazyObject(StringRef Name, LazyObjFile &File, uint8_t Type)
: Lazy(LazyObjectKind, Name, Type) {
this->File = &File;
}

View File

@ -28,8 +28,8 @@ namespace elf {
class ArchiveFile;
class BitcodeFile;
class InputFile;
class LazyObjectFile;
template <class ELFT> class ObjectFile;
class LazyObjFile;
template <class ELFT> class ObjFile;
class OutputSection;
template <class ELFT> class SharedFile;
@ -292,13 +292,13 @@ private:
// --start-lib and --end-lib options.
class LazyObject : public Lazy {
public:
LazyObject(StringRef Name, LazyObjectFile &File, uint8_t Type);
LazyObject(StringRef Name, LazyObjFile &File, uint8_t Type);
static bool classof(const SymbolBody *S) {
return S->kind() == LazyObjectKind;
}
LazyObjectFile *file() { return (LazyObjectFile *)this->File; }
LazyObjFile *file() { return (LazyObjFile *)this->File; }
InputFile *fetch();
};

View File

@ -108,7 +108,7 @@ template <class ELFT> MergeInputSection *elf::createCommentSection() {
Hdr.sh_addralign = 1;
auto *Ret =
make<MergeInputSection>((ObjectFile<ELFT> *)nullptr, &Hdr, ".comment");
make<MergeInputSection>((ObjFile<ELFT> *)nullptr, &Hdr, ".comment");
Ret->Data = getVersion();
Ret->splitIntoPieces();
return Ret;
@ -1815,7 +1815,7 @@ static GdbIndexChunk readDwarf(DWARFContext &Dwarf, InputSection *Sec) {
template <class ELFT> GdbIndexSection *elf::createGdbIndex() {
std::vector<GdbIndexChunk> Chunks;
for (InputSection *Sec : getDebugInfoSections()) {
elf::ObjectFile<ELFT> *F = Sec->getFile<ELFT>();
ObjFile<ELFT> *F = Sec->getFile<ELFT>();
DWARFContext Dwarf(make_unique<LLDDwarfObj<ELFT>>(F));
Chunks.push_back(readDwarf(Dwarf, Sec));
}

View File

@ -471,7 +471,7 @@ static bool includeInSymtab(const SymbolBody &B) {
template <class ELFT> void Writer<ELFT>::copyLocalSymbols() {
if (!InX::SymTab)
return;
for (elf::ObjectFile<ELFT> *F : elf::ObjectFile<ELFT>::Instances) {
for (ObjFile<ELFT> *F : ObjFile<ELFT>::Instances) {
for (SymbolBody *B : F->getLocalSymbols()) {
if (!B->IsLocal)
fatal(toString(F) +
@ -893,7 +893,7 @@ template <class ELFT> static void sortBySymbolsOrder() {
// Build a map from sections to their priorities.
DenseMap<SectionBase *, int> SectionOrder;
for (elf::ObjectFile<ELFT> *File : elf::ObjectFile<ELFT>::Instances) {
for (ObjFile<ELFT> *File : ObjFile<ELFT>::Instances) {
for (SymbolBody *Body : File->getSymbols()) {
auto *D = dyn_cast<DefinedRegular>(Body);
if (!D || !D->Section)

View File

@ -20,7 +20,7 @@ namespace elf {
class InputFile;
class OutputSection;
class InputSectionBase;
template <class ELFT> class ObjectFile;
template <class ELFT> class ObjFile;
class SymbolTable;
template <class ELFT> void writeResult();
template <class ELFT> void markLive();