summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2015-12-16 23:33:56 +0000
committerRui Ueyama <ruiu@google.com>2015-12-16 23:33:56 +0000
commit6192c122f4b183f9bc54b473c2c0e3e9921a0faf (patch)
treee7d6b0fbf452125ea3882603764d1b66c9ba8039
parent25b44c9b2bd7259a0d0a44ac30101371ae263e85 (diff)
downloadbcm5719-llvm-6192c122f4b183f9bc54b473c2c0e3e9921a0faf.tar.gz
bcm5719-llvm-6192c122f4b183f9bc54b473c2c0e3e9921a0faf.zip
ELF: Move shouldUseRela to Writer.cpp.
The function was used only in Writer.cpp and did not depend on SymbolTable. There is no reason to have that function in SymbolTable.cpp. llvm-svn: 255850
-rw-r--r--lld/ELF/SymbolTable.cpp5
-rw-r--r--lld/ELF/SymbolTable.h2
-rw-r--r--lld/ELF/Writer.cpp7
3 files changed, 6 insertions, 8 deletions
diff --git a/lld/ELF/SymbolTable.cpp b/lld/ELF/SymbolTable.cpp
index ebb13af0577..9ca68c82ec3 100644
--- a/lld/ELF/SymbolTable.cpp
+++ b/lld/ELF/SymbolTable.cpp
@@ -28,11 +28,6 @@ using namespace lld::elf2;
template <class ELFT> SymbolTable<ELFT>::SymbolTable() {}
-template <class ELFT> bool SymbolTable<ELFT>::shouldUseRela() const {
- ELFKind K = cast<ELFFileBase<ELFT>>(Config->FirstElf)->getELFKind();
- return K == ELF64LEKind || K == ELF64BEKind;
-}
-
template <class ELFT>
static void checkCompatibility(InputFile *FileP) {
auto *F = dyn_cast<ELFFileBase<ELFT>>(FileP);
diff --git a/lld/ELF/SymbolTable.h b/lld/ELF/SymbolTable.h
index e14f32cb865..0b74efaca4d 100644
--- a/lld/ELF/SymbolTable.h
+++ b/lld/ELF/SymbolTable.h
@@ -36,8 +36,6 @@ public:
void addFile(std::unique_ptr<InputFile> File);
- bool shouldUseRela() const;
-
const llvm::MapVector<StringRef, Symbol *> &getSymbols() const {
return Symtab;
}
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 42c5e779384..6004a5efe0d 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -95,6 +95,11 @@ private:
};
} // anonymous namespace
+template <class ELFT> static bool shouldUseRela() {
+ ELFKind K = cast<ELFFileBase<ELFT>>(Config->FirstElf)->getELFKind();
+ return K == ELF64LEKind || K == ELF64BEKind;
+}
+
template <class ELFT> void lld::elf2::writeResult(SymbolTable<ELFT> *Symtab) {
// Initialize output sections that are handled by Writer specially.
// Don't reorder because the order of initialization matters.
@@ -127,7 +132,7 @@ template <class ELFT> void lld::elf2::writeResult(SymbolTable<ELFT> *Symtab) {
GnuHashTableSection<ELFT> GnuHashTab;
if (Config->GnuHash)
Out<ELFT>::GnuHashTab = &GnuHashTab;
- bool IsRela = Symtab->shouldUseRela();
+ bool IsRela = shouldUseRela<ELFT>();
RelocationSection<ELFT> RelaDyn(IsRela ? ".rela.dyn" : ".rel.dyn", IsRela);
Out<ELFT>::RelaDyn = &RelaDyn;
RelocationSection<ELFT> RelaPlt(IsRela ? ".rela.plt" : ".rel.plt", IsRela);
OpenPOWER on IntegriCloud