summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lld/COFF/InputFiles.cpp7
-rw-r--r--lld/COFF/InputFiles.h5
-rw-r--r--lld/COFF/Symbols.cpp7
-rw-r--r--lld/COFF/Symbols.h5
-rw-r--r--lld/ELF/InputFiles.cpp2
-rw-r--r--lld/ELF/InputFiles.h11
-rw-r--r--lld/ELF/InputSection.cpp10
-rw-r--r--lld/ELF/InputSection.h5
-rw-r--r--lld/ELF/Symbols.cpp2
-rw-r--r--lld/ELF/Symbols.h5
-rw-r--r--lld/ELF/Target.cpp8
-rw-r--r--lld/ELF/Target.h3
12 files changed, 34 insertions, 36 deletions
diff --git a/lld/COFF/InputFiles.cpp b/lld/COFF/InputFiles.cpp
index 0a97c2185f8..cde355cd3f3 100644
--- a/lld/COFF/InputFiles.cpp
+++ b/lld/COFF/InputFiles.cpp
@@ -372,6 +372,8 @@ MachineTypes BitcodeFile::getMachineType() {
return IMAGE_FILE_MACHINE_UNKNOWN;
}
}
+} // namespace coff
+} // namespace lld
// Returns the last element of a path, which is supposed to be a filename.
static StringRef getBasename(StringRef Path) {
@@ -382,7 +384,7 @@ static StringRef getBasename(StringRef Path) {
}
// Returns a string in the format of "foo.obj" or "foo.obj(bar.lib)".
-std::string toString(InputFile *File) {
+std::string lld::toString(coff::InputFile *File) {
if (!File)
return "(internal)";
if (File->ParentName.empty())
@@ -393,6 +395,3 @@ std::string toString(InputFile *File) {
.str();
return StringRef(Res).lower();
}
-
-} // namespace coff
-} // namespace lld
diff --git a/lld/COFF/InputFiles.h b/lld/COFF/InputFiles.h
index 498a1743e98..1b5d42939cc 100644
--- a/lld/COFF/InputFiles.h
+++ b/lld/COFF/InputFiles.h
@@ -202,10 +202,9 @@ private:
llvm::BumpPtrAllocator Alloc;
std::unique_ptr<LTOModule> M;
};
-
-std::string toString(InputFile *File);
-
} // namespace coff
+
+std::string toString(coff::InputFile *File);
} // namespace lld
#endif
diff --git a/lld/COFF/Symbols.cpp b/lld/COFF/Symbols.cpp
index 6de85d581f4..b940bebf36a 100644
--- a/lld/COFF/Symbols.cpp
+++ b/lld/COFF/Symbols.cpp
@@ -73,13 +73,12 @@ Defined *Undefined::getWeakAlias() {
return D;
return nullptr;
}
+} // namespace coff
// Returns a symbol name for an error message.
-std::string toString(SymbolBody &B) {
- if (Optional<std::string> S = demangle(B.getName()))
+std::string lld::toString(coff::SymbolBody &B) {
+ if (Optional<std::string> S = coff::demangle(B.getName()))
return ("\"" + *S + "\" (" + B.getName() + ")").str();
return B.getName();
}
-
-} // namespace coff
} // namespace lld
diff --git a/lld/COFF/Symbols.h b/lld/COFF/Symbols.h
index bc9ad4aa8af..1ca7366364d 100644
--- a/lld/COFF/Symbols.h
+++ b/lld/COFF/Symbols.h
@@ -428,10 +428,9 @@ inline Symbol *SymbolBody::symbol() {
return reinterpret_cast<Symbol *>(reinterpret_cast<char *>(this) -
offsetof(Symbol, Body));
}
-
-std::string toString(SymbolBody &B);
-
} // namespace coff
+
+std::string toString(coff::SymbolBody &B);
} // namespace lld
#endif
diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp
index 522f9603b5e..bd9f25873c8 100644
--- a/lld/ELF/InputFiles.cpp
+++ b/lld/ELF/InputFiles.cpp
@@ -96,7 +96,7 @@ std::string elf::ObjectFile<ELFT>::getLineInfo(InputSectionBase<ELFT> *S,
}
// Returns "(internal)", "foo.a(bar.o)" or "baz.o".
-std::string elf::toString(const InputFile *F) {
+std::string lld::toString(const InputFile *F) {
if (!F)
return "(internal)";
if (!F->ArchiveName.empty())
diff --git a/lld/ELF/InputFiles.h b/lld/ELF/InputFiles.h
index aba1d71379b..8b188348199 100644
--- a/lld/ELF/InputFiles.h
+++ b/lld/ELF/InputFiles.h
@@ -36,10 +36,16 @@ class InputFile;
namespace lld {
namespace elf {
+class InputFile;
+}
+
+// Returns "(internal)", "foo.a(bar.o)" or "baz.o".
+std::string toString(const elf::InputFile *F);
+
+namespace elf {
using llvm::object::Archive;
-class InputFile;
class Lazy;
class SymbolBody;
@@ -84,9 +90,6 @@ private:
const Kind FileKind;
};
-// Returns "(internal)", "foo.a(bar.o)" or "baz.o".
-std::string toString(const InputFile *F);
-
template <typename ELFT> class ELFFileBase : public InputFile {
public:
typedef typename ELFT::Shdr Elf_Shdr;
diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp
index 805e51dab50..e87d92aa207 100644
--- a/lld/ELF/InputSection.cpp
+++ b/lld/ELF/InputSection.cpp
@@ -34,7 +34,7 @@ using namespace lld::elf;
// Returns a string to construct an error message.
template <class ELFT>
-std::string elf::toString(const InputSectionBase<ELFT> *Sec) {
+std::string lld::toString(const InputSectionBase<ELFT> *Sec) {
return (Sec->getFile()->getName() + ":(" + Sec->Name + ")").str();
}
@@ -844,7 +844,7 @@ template class elf::MergeInputSection<ELF32BE>;
template class elf::MergeInputSection<ELF64LE>;
template class elf::MergeInputSection<ELF64BE>;
-template std::string elf::toString(const InputSectionBase<ELF32LE> *);
-template std::string elf::toString(const InputSectionBase<ELF32BE> *);
-template std::string elf::toString(const InputSectionBase<ELF64LE> *);
-template std::string elf::toString(const InputSectionBase<ELF64BE> *);
+template std::string lld::toString(const InputSectionBase<ELF32LE> *);
+template std::string lld::toString(const InputSectionBase<ELF32BE> *);
+template std::string lld::toString(const InputSectionBase<ELF64LE> *);
+template std::string lld::toString(const InputSectionBase<ELF64BE> *);
diff --git a/lld/ELF/InputSection.h b/lld/ELF/InputSection.h
index adbc1e1e382..fc7a7fb6097 100644
--- a/lld/ELF/InputSection.h
+++ b/lld/ELF/InputSection.h
@@ -318,10 +318,9 @@ private:
};
template <class ELFT> InputSection<ELFT> InputSection<ELFT>::Discarded;
-
-template <class ELFT> std::string toString(const InputSectionBase<ELFT> *);
-
} // namespace elf
+
+template <class ELFT> std::string toString(const elf::InputSectionBase<ELFT> *);
} // namespace lld
#endif
diff --git a/lld/ELF/Symbols.cpp b/lld/ELF/Symbols.cpp
index f168d37bdf0..72bcff4e0f4 100644
--- a/lld/ELF/Symbols.cpp
+++ b/lld/ELF/Symbols.cpp
@@ -305,7 +305,7 @@ void elf::printTraceSymbol(Symbol *Sym) {
}
// Returns a symbol for an error message.
-std::string elf::toString(const SymbolBody &B) {
+std::string lld::toString(const SymbolBody &B) {
if (Config->Demangle)
if (Optional<std::string> S = demangle(B.getName()))
return *S;
diff --git a/lld/ELF/Symbols.h b/lld/ELF/Symbols.h
index cbf8fa81a13..38889571679 100644
--- a/lld/ELF/Symbols.h
+++ b/lld/ELF/Symbols.h
@@ -453,10 +453,9 @@ inline Symbol *SymbolBody::symbol() {
return reinterpret_cast<Symbol *>(reinterpret_cast<char *>(this) -
offsetof(Symbol, Body));
}
-
-std::string toString(const SymbolBody &B);
-
} // namespace elf
+
+std::string toString(const elf::SymbolBody &B);
} // namespace lld
#endif
diff --git a/lld/ELF/Target.cpp b/lld/ELF/Target.cpp
index d82e654b9c4..cb2b178fa84 100644
--- a/lld/ELF/Target.cpp
+++ b/lld/ELF/Target.cpp
@@ -44,6 +44,10 @@ using namespace llvm::object;
using namespace llvm::support::endian;
using namespace llvm::ELF;
+std::string lld::toString(uint32_t Type) {
+ return getELFRelocationTypeName(elf::Config->EMachine, Type);
+}
+
namespace lld {
namespace elf {
@@ -52,10 +56,6 @@ TargetInfo *Target;
static void or32le(uint8_t *P, int32_t V) { write32le(P, read32le(P) | V); }
static void or32be(uint8_t *P, int32_t V) { write32be(P, read32be(P) | V); }
-std::string toString(uint32_t Type) {
- return getELFRelocationTypeName(Config->EMachine, Type);
-}
-
template <class ELFT> static std::string getErrorLoc(uint8_t *Loc) {
for (InputSectionData *D : Symtab<ELFT>::X->Sections) {
auto *IS = dyn_cast_or_null<InputSection<ELFT>>(D);
diff --git a/lld/ELF/Target.h b/lld/ELF/Target.h
index 156a2c02323..752f9cd5ee4 100644
--- a/lld/ELF/Target.h
+++ b/lld/ELF/Target.h
@@ -104,13 +104,14 @@ public:
virtual void relaxTlsLdToLe(uint8_t *Loc, uint32_t Type, uint64_t Val) const;
};
-std::string toString(uint32_t RelType);
uint64_t getPPC64TocBase();
uint64_t getAArch64Page(uint64_t Expr);
extern TargetInfo *Target;
TargetInfo *createTarget();
}
+
+std::string toString(uint32_t RelType);
}
#endif
OpenPOWER on IntegriCloud