diff --git a/lld/ELF/CMakeLists.txt b/lld/ELF/CMakeLists.txt index ade5edcacaa6..21292e5eaeb8 100644 --- a/lld/ELF/CMakeLists.txt +++ b/lld/ELF/CMakeLists.txt @@ -2,7 +2,7 @@ set(LLVM_TARGET_DEFINITIONS Options.td) tablegen(LLVM Options.inc -gen-opt-parser-defs) add_public_tablegen_target(ELFOptionsTableGen) -add_lld_library(lldELF2 +add_lld_library(lldELF Driver.cpp DriverUtils.cpp Error.cpp @@ -24,4 +24,4 @@ add_lld_library(lldELF2 Support ) -add_dependencies(lldELF2 ELFOptionsTableGen) +add_dependencies(lldELF ELFOptionsTableGen) diff --git a/lld/ELF/Config.h b/lld/ELF/Config.h index b601b1e2f912..847fb81559b3 100644 --- a/lld/ELF/Config.h +++ b/lld/ELF/Config.h @@ -17,7 +17,7 @@ #include namespace lld { -namespace elf2 { +namespace elf { class InputFile; class SymbolBody; @@ -88,7 +88,7 @@ struct Configuration { // The only instance of Configuration struct. extern Configuration *Config; -} // namespace elf2 +} // namespace elf } // namespace lld #endif diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp index daef69f6692d..b55f601906fc 100644 --- a/lld/ELF/Driver.cpp +++ b/lld/ELF/Driver.cpp @@ -27,12 +27,12 @@ using namespace llvm::ELF; using namespace llvm::object; using namespace lld; -using namespace lld::elf2; +using namespace lld::elf; -Configuration *elf2::Config; -LinkerDriver *elf2::Driver; +Configuration *elf::Config; +LinkerDriver *elf::Driver; -bool elf2::link(ArrayRef Args, raw_ostream &Error) { +bool elf::link(ArrayRef Args, raw_ostream &Error) { HasError = false; ErrorOS = &Error; Configuration C; diff --git a/lld/ELF/Driver.h b/lld/ELF/Driver.h index c7b2d9ffad5a..52bf22ba539d 100644 --- a/lld/ELF/Driver.h +++ b/lld/ELF/Driver.h @@ -17,7 +17,7 @@ #include "llvm/Support/raw_ostream.h" namespace lld { -namespace elf2 { +namespace elf { extern class LinkerDriver *Driver; @@ -57,7 +57,7 @@ std::string findFromSearchPaths(StringRef Path); std::string searchLibrary(StringRef Path); std::string buildSysrootedPath(llvm::StringRef Dir, llvm::StringRef File); -} // namespace elf2 +} // namespace elf } // namespace lld #endif diff --git a/lld/ELF/DriverUtils.cpp b/lld/ELF/DriverUtils.cpp index bbe5f9fc9034..336d85091525 100644 --- a/lld/ELF/DriverUtils.cpp +++ b/lld/ELF/DriverUtils.cpp @@ -24,7 +24,7 @@ using namespace llvm; using namespace lld; -using namespace lld::elf2; +using namespace lld::elf; // Create OptTable @@ -51,8 +51,8 @@ public: }; // Parses a given list of options. -opt::InputArgList elf2::parseArgs(llvm::BumpPtrAllocator *A, - ArrayRef Argv) { +opt::InputArgList elf::parseArgs(llvm::BumpPtrAllocator *A, + ArrayRef Argv) { // Make InputArgList from string vectors. ELFOptTable Table; unsigned MissingIndex; @@ -78,7 +78,7 @@ opt::InputArgList elf2::parseArgs(llvm::BumpPtrAllocator *A, return Args; } -std::string elf2::findFromSearchPaths(StringRef Path) { +std::string elf::findFromSearchPaths(StringRef Path) { for (StringRef Dir : Config->SearchPaths) { std::string FullPath = buildSysrootedPath(Dir, Path); if (sys::fs::exists(FullPath)) @@ -89,7 +89,7 @@ std::string elf2::findFromSearchPaths(StringRef Path) { // Searches a given library from input search paths, which are filled // from -L command line switches. Returns a path to an existent library file. -std::string elf2::searchLibrary(StringRef Path) { +std::string elf::searchLibrary(StringRef Path) { std::vector Names; if (Path[0] == ':') { Names.push_back(Path.drop_front()); @@ -109,7 +109,7 @@ std::string elf2::searchLibrary(StringRef Path) { // Makes a path by concatenating Dir and File. // If Dir starts with '=' the result will be preceded by Sysroot, // which can be set with --sysroot command line switch. -std::string elf2::buildSysrootedPath(StringRef Dir, StringRef File) { +std::string elf::buildSysrootedPath(StringRef Dir, StringRef File) { SmallString<128> Path; if (Dir.startswith("=")) sys::path::append(Path, Config->Sysroot, Dir.substr(1), File); diff --git a/lld/ELF/Error.cpp b/lld/ELF/Error.cpp index 2f78108010e1..75b460410c86 100644 --- a/lld/ELF/Error.cpp +++ b/lld/ELF/Error.cpp @@ -14,7 +14,7 @@ #include "llvm/Support/raw_ostream.h" namespace lld { -namespace elf2 { +namespace elf { bool HasError; llvm::raw_ostream *ErrorOS; @@ -60,5 +60,5 @@ void fatal(std::error_code EC) { fatal(EC.message()); } -} // namespace elf2 +} // namespace elf } // namespace lld diff --git a/lld/ELF/Error.h b/lld/ELF/Error.h index 941190e84d37..8ea468d59f6a 100644 --- a/lld/ELF/Error.h +++ b/lld/ELF/Error.h @@ -17,7 +17,7 @@ class raw_ostream; } namespace lld { -namespace elf2 { +namespace elf { extern bool HasError; extern llvm::raw_ostream *ErrorOS; @@ -47,7 +47,7 @@ template void fatal(const ErrorOr &V, const Twine &Prefix) { template void fatal(const ErrorOr &V) { fatal(V.getError()); } -} // namespace elf2 +} // namespace elf } // namespace lld #endif diff --git a/lld/ELF/ICF.cpp b/lld/ELF/ICF.cpp index 18d211085485..bef52777474a 100644 --- a/lld/ELF/ICF.cpp +++ b/lld/ELF/ICF.cpp @@ -66,13 +66,13 @@ #include "llvm/Support/raw_ostream.h" using namespace lld; -using namespace lld::elf2; +using namespace lld::elf; using namespace llvm; using namespace llvm::ELF; using namespace llvm::object; namespace lld { -namespace elf2 { +namespace elf { template class ICF { typedef typename ELFFile::Elf_Shdr Elf_Shdr; typedef typename ELFFile::Elf_Sym Elf_Sym; @@ -361,11 +361,11 @@ template void ICF::run(SymbolTable *Symtab) { } // ICF entry point function. -template void elf2::doIcf(SymbolTable *Symtab) { +template void elf::doIcf(SymbolTable *Symtab) { ICF().run(Symtab); } -template void elf2::doIcf(SymbolTable *); -template void elf2::doIcf(SymbolTable *); -template void elf2::doIcf(SymbolTable *); -template void elf2::doIcf(SymbolTable *); +template void elf::doIcf(SymbolTable *); +template void elf::doIcf(SymbolTable *); +template void elf::doIcf(SymbolTable *); +template void elf::doIcf(SymbolTable *); diff --git a/lld/ELF/ICF.h b/lld/ELF/ICF.h index 034f55c23730..63ad780ad486 100644 --- a/lld/ELF/ICF.h +++ b/lld/ELF/ICF.h @@ -11,7 +11,7 @@ #define LLD_ELF_ICF_H namespace lld { -namespace elf2 { +namespace elf { template class SymbolTable; diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp index da2e30c77101..5f5ac9e0e2fb 100644 --- a/lld/ELF/InputFiles.cpp +++ b/lld/ELF/InputFiles.cpp @@ -22,7 +22,7 @@ using namespace llvm::object; using namespace llvm::sys::fs; using namespace lld; -using namespace lld::elf2; +using namespace lld::elf; namespace { class ECRAII { @@ -86,24 +86,24 @@ ELFFileBase::getNonLocalSymbols() { } template -elf2::ObjectFile::ObjectFile(MemoryBufferRef M) +elf::ObjectFile::ObjectFile(MemoryBufferRef M) : ELFFileBase(Base::ObjectKind, M) {} template -typename elf2::ObjectFile::Elf_Sym_Range -elf2::ObjectFile::getLocalSymbols() { +typename elf::ObjectFile::Elf_Sym_Range +elf::ObjectFile::getLocalSymbols() { return this->getSymbolsHelper(true); } -template uint32_t elf2::ObjectFile::getMipsGp0() const { +template uint32_t elf::ObjectFile::getMipsGp0() const { if (MipsReginfo) return MipsReginfo->Reginfo->ri_gp_value; return 0; } template -const typename elf2::ObjectFile::Elf_Sym * -elf2::ObjectFile::getLocalSymbol(uintX_t SymIndex) { +const typename elf::ObjectFile::Elf_Sym * +elf::ObjectFile::getLocalSymbol(uintX_t SymIndex) { uint32_t FirstNonLocal = this->Symtab->sh_info; if (SymIndex >= FirstNonLocal) return nullptr; @@ -112,7 +112,7 @@ elf2::ObjectFile::getLocalSymbol(uintX_t SymIndex) { } template -void elf2::ObjectFile::parse(DenseSet &ComdatGroups) { +void elf::ObjectFile::parse(DenseSet &ComdatGroups) { // Read section and symbol tables. initializeSections(ComdatGroups); initializeSymbols(); @@ -122,7 +122,7 @@ void elf2::ObjectFile::parse(DenseSet &ComdatGroups) { // They are identified and deduplicated by group name. This function // returns a group name. template -StringRef elf2::ObjectFile::getShtGroupSignature(const Elf_Shdr &Sec) { +StringRef elf::ObjectFile::getShtGroupSignature(const Elf_Shdr &Sec) { const ELFFile &Obj = this->ELFObj; uint32_t SymtabdSectionIndex = Sec.sh_link; ErrorOr SecOrErr = Obj.getSection(SymtabdSectionIndex); @@ -138,8 +138,8 @@ StringRef elf2::ObjectFile::getShtGroupSignature(const Elf_Shdr &Sec) { } template -ArrayRef::uint32_X> -elf2::ObjectFile::getShtGroupEntries(const Elf_Shdr &Sec) { +ArrayRef::uint32_X> +elf::ObjectFile::getShtGroupEntries(const Elf_Shdr &Sec) { const ELFFile &Obj = this->ELFObj; ErrorOr> EntriesOrErr = Obj.template getSectionContentsAsArray(&Sec); @@ -178,7 +178,7 @@ static bool shouldMerge(const typename ELFFile::Elf_Shdr &Sec) { } template -void elf2::ObjectFile::initializeSections( +void elf::ObjectFile::initializeSections( DenseSet &ComdatGroups) { uint64_t Size = this->ELFObj.getNumSections(); Sections.resize(Size); @@ -248,7 +248,7 @@ void elf2::ObjectFile::initializeSections( template InputSectionBase * -elf2::ObjectFile::createInputSection(const Elf_Shdr &Sec) { +elf::ObjectFile::createInputSection(const Elf_Shdr &Sec) { ErrorOr NameOrErr = this->ELFObj.getSectionName(&Sec); fatal(NameOrErr); StringRef Name = *NameOrErr; @@ -274,7 +274,7 @@ elf2::ObjectFile::createInputSection(const Elf_Shdr &Sec) { return new (Alloc) InputSection(this, &Sec); } -template void elf2::ObjectFile::initializeSymbols() { +template void elf::ObjectFile::initializeSymbols() { this->initStringTable(); Elf_Sym_Range Syms = this->getNonLocalSymbols(); uint32_t NumSymbols = std::distance(Syms.begin(), Syms.end()); @@ -285,7 +285,7 @@ template void elf2::ObjectFile::initializeSymbols() { template InputSectionBase * -elf2::ObjectFile::getSection(const Elf_Sym &Sym) const { +elf::ObjectFile::getSection(const Elf_Sym &Sym) const { uint32_t Index = this->getSectionIndex(Sym); if (Index == 0) return nullptr; @@ -298,7 +298,7 @@ elf2::ObjectFile::getSection(const Elf_Sym &Sym) const { } template -SymbolBody *elf2::ObjectFile::createSymbolBody(const Elf_Sym *Sym) { +SymbolBody *elf::ObjectFile::createSymbolBody(const Elf_Sym *Sym) { ErrorOr NameOrErr = Sym->getName(this->StringTable); fatal(NameOrErr); StringRef Name = *NameOrErr; @@ -497,8 +497,8 @@ static std::unique_ptr createELFFile(MemoryBufferRef MB) { fatal("Invalid file class: " + MB.getBufferIdentifier()); } -std::unique_ptr elf2::createObjectFile(MemoryBufferRef MB, - StringRef ArchiveName) { +std::unique_ptr elf::createObjectFile(MemoryBufferRef MB, + StringRef ArchiveName) { using namespace sys::fs; std::unique_ptr F; if (identify_magic(MB.getBuffer()) == file_magic::bitcode) @@ -509,21 +509,21 @@ std::unique_ptr elf2::createObjectFile(MemoryBufferRef MB, return F; } -std::unique_ptr elf2::createSharedFile(MemoryBufferRef MB) { +std::unique_ptr elf::createSharedFile(MemoryBufferRef MB) { return createELFFile(MB); } -template class elf2::ELFFileBase; -template class elf2::ELFFileBase; -template class elf2::ELFFileBase; -template class elf2::ELFFileBase; +template class elf::ELFFileBase; +template class elf::ELFFileBase; +template class elf::ELFFileBase; +template class elf::ELFFileBase; -template class elf2::ObjectFile; -template class elf2::ObjectFile; -template class elf2::ObjectFile; -template class elf2::ObjectFile; +template class elf::ObjectFile; +template class elf::ObjectFile; +template class elf::ObjectFile; +template class elf::ObjectFile; -template class elf2::SharedFile; -template class elf2::SharedFile; -template class elf2::SharedFile; -template class elf2::SharedFile; +template class elf::SharedFile; +template class elf::SharedFile; +template class elf::SharedFile; +template class elf::SharedFile; diff --git a/lld/ELF/InputFiles.h b/lld/ELF/InputFiles.h index 49e2e757f152..18debd420b59 100644 --- a/lld/ELF/InputFiles.h +++ b/lld/ELF/InputFiles.h @@ -23,7 +23,7 @@ #include "llvm/Support/StringSaver.h" namespace lld { -namespace elf2 { +namespace elf { using llvm::object::Archive; @@ -231,7 +231,7 @@ std::unique_ptr createObjectFile(MemoryBufferRef MB, StringRef ArchiveName = ""); std::unique_ptr createSharedFile(MemoryBufferRef MB); -} // namespace elf2 +} // namespace elf } // namespace lld #endif diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp index 9ac5514bb5ec..4bdb45ee07df 100644 --- a/lld/ELF/InputSection.cpp +++ b/lld/ELF/InputSection.cpp @@ -22,7 +22,7 @@ using namespace llvm::object; using namespace llvm::support::endian; using namespace lld; -using namespace lld::elf2; +using namespace lld::elf; template InputSectionBase::InputSectionBase(ObjectFile *File, @@ -459,27 +459,27 @@ bool MipsReginfoInputSection::classof(const InputSectionBase *S) { return S->SectionKind == InputSectionBase::MipsReginfo; } -template class elf2::InputSectionBase; -template class elf2::InputSectionBase; -template class elf2::InputSectionBase; -template class elf2::InputSectionBase; +template class elf::InputSectionBase; +template class elf::InputSectionBase; +template class elf::InputSectionBase; +template class elf::InputSectionBase; -template class elf2::InputSection; -template class elf2::InputSection; -template class elf2::InputSection; -template class elf2::InputSection; +template class elf::InputSection; +template class elf::InputSection; +template class elf::InputSection; +template class elf::InputSection; -template class elf2::EHInputSection; -template class elf2::EHInputSection; -template class elf2::EHInputSection; -template class elf2::EHInputSection; +template class elf::EHInputSection; +template class elf::EHInputSection; +template class elf::EHInputSection; +template class elf::EHInputSection; -template class elf2::MergeInputSection; -template class elf2::MergeInputSection; -template class elf2::MergeInputSection; -template class elf2::MergeInputSection; +template class elf::MergeInputSection; +template class elf::MergeInputSection; +template class elf::MergeInputSection; +template class elf::MergeInputSection; -template class elf2::MipsReginfoInputSection; -template class elf2::MipsReginfoInputSection; -template class elf2::MipsReginfoInputSection; -template class elf2::MipsReginfoInputSection; +template class elf::MipsReginfoInputSection; +template class elf::MipsReginfoInputSection; +template class elf::MipsReginfoInputSection; +template class elf::MipsReginfoInputSection; diff --git a/lld/ELF/InputSection.h b/lld/ELF/InputSection.h index 9585a5683782..f7c977b87401 100644 --- a/lld/ELF/InputSection.h +++ b/lld/ELF/InputSection.h @@ -16,7 +16,7 @@ #include "llvm/Object/ELF.h" namespace lld { -namespace elf2 { +namespace elf { template class ICF; template class ObjectFile; @@ -202,7 +202,7 @@ public: const llvm::object::Elf_Mips_RegInfo *Reginfo; }; -} // namespace elf2 +} // namespace elf } // namespace lld #endif diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp index a146be0ebc72..c1ca43d9440f 100644 --- a/lld/ELF/LinkerScript.cpp +++ b/lld/ELF/LinkerScript.cpp @@ -26,9 +26,9 @@ using namespace llvm; using namespace llvm::object; using namespace lld; -using namespace lld::elf2; +using namespace lld::elf; -LinkerScript *elf2::Script; +LinkerScript *elf::Script; template SectionRule *LinkerScript::find(InputSectionBase *S) { @@ -103,7 +103,7 @@ template bool SectionRule::match(InputSectionBase *S) { return matchStr(SectionPattern, S->getSectionName()); } -class elf2::ScriptParser { +class elf::ScriptParser { typedef void (ScriptParser::*Handler)(); public: @@ -149,7 +149,7 @@ private: bool Error = false; }; -const StringMap elf2::ScriptParser::Cmd = { +const StringMap elf::ScriptParser::Cmd = { {"ENTRY", &ScriptParser::readEntry}, {"EXTERN", &ScriptParser::readExtern}, {"GROUP", &ScriptParser::readGroup}, diff --git a/lld/ELF/LinkerScript.h b/lld/ELF/LinkerScript.h index c534478998f5..7517838c8864 100644 --- a/lld/ELF/LinkerScript.h +++ b/lld/ELF/LinkerScript.h @@ -17,7 +17,7 @@ #include "llvm/Support/MemoryBuffer.h" namespace lld { -namespace elf2 { +namespace elf { class ScriptParser; template class InputSectionBase; @@ -75,7 +75,7 @@ private: extern LinkerScript *Script; -} // namespace elf2 +} // namespace elf } // namespace lld #endif diff --git a/lld/ELF/MarkLive.cpp b/lld/ELF/MarkLive.cpp index 3f8b2248e90c..40bcee5a6ba7 100644 --- a/lld/ELF/MarkLive.cpp +++ b/lld/ELF/MarkLive.cpp @@ -36,7 +36,7 @@ using namespace llvm::ELF; using namespace llvm::object; using namespace lld; -using namespace lld::elf2; +using namespace lld::elf; // Calls Fn for each section that Sec refers to via relocations. template @@ -86,7 +86,7 @@ template static bool isReserved(InputSectionBase *Sec) { // This is the main function of the garbage collector. // Starting from GC-root sections, this function visits all reachable // sections to set their "Live" bits. -template void elf2::markLive(SymbolTable *Symtab) { +template void elf::markLive(SymbolTable *Symtab) { SmallVector *, 256> Q; auto Enqueue = [&](InputSectionBase *Sec) { @@ -133,7 +133,7 @@ template void elf2::markLive(SymbolTable *Symtab) { forEachSuccessor(Q.pop_back_val(), Enqueue); } -template void elf2::markLive(SymbolTable *); -template void elf2::markLive(SymbolTable *); -template void elf2::markLive(SymbolTable *); -template void elf2::markLive(SymbolTable *); +template void elf::markLive(SymbolTable *); +template void elf::markLive(SymbolTable *); +template void elf::markLive(SymbolTable *); +template void elf::markLive(SymbolTable *); diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp index 523ddd011a49..bec005e98620 100644 --- a/lld/ELF/OutputSections.cpp +++ b/lld/ELF/OutputSections.cpp @@ -23,7 +23,7 @@ using namespace llvm::support::endian; using namespace llvm::ELF; using namespace lld; -using namespace lld::elf2; +using namespace lld::elf; static bool isAlpha(char C) { return ('a' <= C && C <= 'z') || ('A' <= C && C <= 'Z') || C == '_'; @@ -32,7 +32,7 @@ static bool isAlpha(char C) { static bool isAlnum(char C) { return isAlpha(C) || ('0' <= C && C <= '9'); } // Returns true if S is valid as a C language identifier. -bool elf2::isValidCIdentifier(StringRef S) { +bool elf::isValidCIdentifier(StringRef S) { return !S.empty() && isAlpha(S[0]) && std::all_of(S.begin() + 1, S.end(), isAlnum); } @@ -886,9 +886,9 @@ template void OutputSection::sortCtorsDtors() { // For non-local symbols, use SymbolBody::getVA instead. template typename ELFFile::uintX_t -elf2::getLocalRelTarget(const ObjectFile &File, - const Elf_Rel_Impl &RI, - typename ELFFile::uintX_t Addend) { +elf::getLocalRelTarget(const ObjectFile &File, + const Elf_Rel_Impl &RI, + typename ELFFile::uintX_t Addend) { typedef typename ELFFile::Elf_Sym Elf_Sym; typedef typename ELFFile::uintX_t uintX_t; @@ -926,7 +926,7 @@ elf2::getLocalRelTarget(const ObjectFile &File, // Returns true if a symbol can be replaced at load-time by a symbol // with the same name defined in other ELF executable or DSO. -bool elf2::canBePreempted(const SymbolBody *Body) { +bool elf::canBePreempted(const SymbolBody *Body) { if (!Body) return false; // Body is a local symbol. if (Body->isShared()) @@ -1586,7 +1586,7 @@ void MipsReginfoOutputSection::addSection(InputSectionBase *C) { } namespace lld { -namespace elf2 { +namespace elf { template class OutputSectionBase; template class OutputSectionBase; template class OutputSectionBase; diff --git a/lld/ELF/OutputSections.h b/lld/ELF/OutputSections.h index 48cb0c1d8708..8ded7d7fca77 100644 --- a/lld/ELF/OutputSections.h +++ b/lld/ELF/OutputSections.h @@ -20,7 +20,7 @@ #include namespace lld { -namespace elf2 { +namespace elf { class SymbolBody; template class SymbolTable; @@ -579,7 +579,7 @@ template typename Out::Elf_Phdr *Out::TlsPhdr; template OutputSectionBase *Out::ElfHeader; template OutputSectionBase *Out::ProgramHeaders; -} // namespace elf2 +} // namespace elf } // namespace lld #endif // LLD_ELF_OUTPUT_SECTIONS_H diff --git a/lld/ELF/README.md b/lld/ELF/README.md index a7188021fb0c..686ba57f2e98 100644 --- a/lld/ELF/README.md +++ b/lld/ELF/README.md @@ -24,7 +24,7 @@ Library Use ----------- You can embed LLD to your program by linking against it and calling the linker's -entry point function lld::elf2::link. +entry point function lld::elf::link. The current policy is that it is your reponsibility to give trustworthy object files. The function is guaranteed to return as long as you do not pass corrupted diff --git a/lld/ELF/SymbolTable.cpp b/lld/ELF/SymbolTable.cpp index e844f71cdb38..8857d654aa9f 100644 --- a/lld/ELF/SymbolTable.cpp +++ b/lld/ELF/SymbolTable.cpp @@ -30,7 +30,7 @@ using namespace llvm::object; using namespace llvm::ELF; using namespace lld; -using namespace lld::elf2; +using namespace lld::elf; // All input object files must be for the same architecture // (e.g. it does not make sense to link x86 object files with @@ -356,7 +356,7 @@ template void SymbolTable::scanShlibUndefined() { Sym->MustBeInDynSym = true; } -template class elf2::SymbolTable; -template class elf2::SymbolTable; -template class elf2::SymbolTable; -template class elf2::SymbolTable; +template class elf::SymbolTable; +template class elf::SymbolTable; +template class elf::SymbolTable; +template class elf::SymbolTable; diff --git a/lld/ELF/SymbolTable.h b/lld/ELF/SymbolTable.h index 632e71bf36dd..1f602e702e44 100644 --- a/lld/ELF/SymbolTable.h +++ b/lld/ELF/SymbolTable.h @@ -18,7 +18,7 @@ class Module; } namespace lld { -namespace elf2 { +namespace elf { class Lazy; template class OutputSectionBase; struct Symbol; @@ -103,7 +103,7 @@ private: llvm::DenseSet SoNames; }; -} // namespace elf2 +} // namespace elf } // namespace lld #endif diff --git a/lld/ELF/Symbols.cpp b/lld/ELF/Symbols.cpp index 125e6c7a7b64..6e094a323d04 100644 --- a/lld/ELF/Symbols.cpp +++ b/lld/ELF/Symbols.cpp @@ -26,7 +26,7 @@ using namespace llvm::object; using namespace llvm::ELF; using namespace lld; -using namespace lld::elf2; +using namespace lld::elf; template typename ELFFile::uintX_t SymbolBody::getVA() const { @@ -223,7 +223,7 @@ template static void doInitSymbols() { ElfSym::Ignored.setVisibility(STV_HIDDEN); } -void elf2::initSymbols() { +void elf::initSymbols() { doInitSymbols(); doInitSymbols(); doInitSymbols(); @@ -231,7 +231,7 @@ void elf2::initSymbols() { } // Returns the demangled C++ symbol name for Name. -std::string elf2::demangle(StringRef Name) { +std::string elf::demangle(StringRef Name) { #if !defined(HAVE_CXXABI_H) return Name; #else @@ -286,12 +286,12 @@ template int SymbolBody::compare(SymbolBody *Other); template int SymbolBody::compare(SymbolBody *Other); template int SymbolBody::compare(SymbolBody *Other); -template class elf2::UndefinedElf; -template class elf2::UndefinedElf; -template class elf2::UndefinedElf; -template class elf2::UndefinedElf; +template class elf::UndefinedElf; +template class elf::UndefinedElf; +template class elf::UndefinedElf; +template class elf::UndefinedElf; -template class elf2::DefinedSynthetic; -template class elf2::DefinedSynthetic; -template class elf2::DefinedSynthetic; -template class elf2::DefinedSynthetic; +template class elf::DefinedSynthetic; +template class elf::DefinedSynthetic; +template class elf::DefinedSynthetic; +template class elf::DefinedSynthetic; diff --git a/lld/ELF/Symbols.h b/lld/ELF/Symbols.h index 0c95475318cd..ea2c2e13ab80 100644 --- a/lld/ELF/Symbols.h +++ b/lld/ELF/Symbols.h @@ -30,7 +30,7 @@ #include "llvm/Object/ELF.h" namespace lld { -namespace elf2 { +namespace elf { class ArchiveFile; class InputFile; @@ -373,7 +373,7 @@ template typename ElfSym::Elf_Sym ElfSym::RelaIpltStart; template typename ElfSym::Elf_Sym ElfSym::RelaIpltEnd; -} // namespace elf2 +} // namespace elf } // namespace lld #endif diff --git a/lld/ELF/Target.cpp b/lld/ELF/Target.cpp index 808bf4e9c932..893bb5ee0e18 100644 --- a/lld/ELF/Target.cpp +++ b/lld/ELF/Target.cpp @@ -31,7 +31,7 @@ using namespace llvm::support::endian; using namespace llvm::ELF; namespace lld { -namespace elf2 { +namespace elf { TargetInfo *Target; diff --git a/lld/ELF/Target.h b/lld/ELF/Target.h index 3e30631e3756..535b2c888826 100644 --- a/lld/ELF/Target.h +++ b/lld/ELF/Target.h @@ -16,7 +16,7 @@ #include namespace lld { -namespace elf2 { +namespace elf { class SymbolBody; class TargetInfo { diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index a903f27cbbc2..19053e7cc5ed 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -26,7 +26,7 @@ using namespace llvm::ELF; using namespace llvm::object; using namespace lld; -using namespace lld::elf2; +using namespace lld::elf; namespace { // The writer writes a SymbolTable result to a file. @@ -123,7 +123,7 @@ private: template static bool shouldUseRela() { return ELFT::Is64Bits; } -template void elf2::writeResult(SymbolTable *Symtab) { +template void elf::writeResult(SymbolTable *Symtab) { typedef typename ELFFile::uintX_t uintX_t; // Create singleton output sections. @@ -1535,7 +1535,7 @@ template void Writer::writeSections() { Sec->writeTo(Buf + Sec->getFileOff()); } -template void elf2::writeResult(SymbolTable *Symtab); -template void elf2::writeResult(SymbolTable *Symtab); -template void elf2::writeResult(SymbolTable *Symtab); -template void elf2::writeResult(SymbolTable *Symtab); +template void elf::writeResult(SymbolTable *Symtab); +template void elf::writeResult(SymbolTable *Symtab); +template void elf::writeResult(SymbolTable *Symtab); +template void elf::writeResult(SymbolTable *Symtab); diff --git a/lld/ELF/Writer.h b/lld/ELF/Writer.h index 40a1711e2bd2..fdd4adff25b1 100644 --- a/lld/ELF/Writer.h +++ b/lld/ELF/Writer.h @@ -11,7 +11,7 @@ #define LLD_ELF_WRITER_H namespace lld { -namespace elf2 { +namespace elf { template class SymbolTable; diff --git a/lld/include/lld/Driver/Driver.h b/lld/include/lld/Driver/Driver.h index 37ef4945b5e6..c08fcce1e7d0 100644 --- a/lld/include/lld/Driver/Driver.h +++ b/lld/include/lld/Driver/Driver.h @@ -87,7 +87,7 @@ namespace coff { void link(llvm::ArrayRef args); } -namespace elf2 { +namespace elf { bool link(llvm::ArrayRef args, raw_ostream &diag = llvm::errs()); } diff --git a/lld/lib/Driver/CMakeLists.txt b/lld/lib/Driver/CMakeLists.txt index 40b1b2b86c4b..7c3a612d75dc 100644 --- a/lld/lib/Driver/CMakeLists.txt +++ b/lld/lib/Driver/CMakeLists.txt @@ -19,7 +19,7 @@ add_lld_library(lldDriver lldConfig lldMachO lldCOFF - lldELF2 + lldELF lldCore lldReaderWriter lldYAML diff --git a/lld/lib/Driver/UniversalDriver.cpp b/lld/lib/Driver/UniversalDriver.cpp index c2372cbd436d..14b34ba38fd5 100644 --- a/lld/lib/Driver/UniversalDriver.cpp +++ b/lld/lib/Driver/UniversalDriver.cpp @@ -201,7 +201,7 @@ bool UniversalDriver::link(llvm::MutableArrayRef args, // Switch to appropriate driver. switch (flavor) { case Flavor::gnu_ld: - return elf2::link(args, diagnostics); + return elf::link(args, diagnostics); case Flavor::darwin_ld: return DarwinLdDriver::linkMachO(args, diagnostics); case Flavor::win_link: