From 78aa27004110fe9179512d93fb1b1e5fed8b02b8 Mon Sep 17 00:00:00 2001 From: George Rimar Date: Mon, 13 Mar 2017 14:40:58 +0000 Subject: [PATCH] [ELF] - Remove unnecessary template. NFC. llvm-svn: 297622 --- lld/ELF/LinkerScript.cpp | 6 +----- lld/ELF/LinkerScript.h | 2 -- lld/ELF/OutputSections.cpp | 6 ++++++ lld/ELF/OutputSections.h | 6 +----- lld/ELF/Writer.cpp | 4 ++-- 5 files changed, 10 insertions(+), 14 deletions(-) diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp index 8a1c6e526ab1..fb309cee9716 100644 --- a/lld/ELF/LinkerScript.cpp +++ b/lld/ELF/LinkerScript.cpp @@ -932,10 +932,6 @@ uint64_t LinkerScript::getOutputSectionSize(StringRef Name) { return 0; } -template uint64_t LinkerScript::getHeaderSize() { - return elf::getHeaderSize(); -} - template uint64_t LinkerScript::getSymbolValue(const Twine &Loc, StringRef S) { if (S == ".") @@ -1835,7 +1831,7 @@ Expr ScriptParser::readPrimary() { [=] { return ScriptBase->getOutputSection(Location, Name)->Alignment; }; } if (Tok == "SIZEOF_HEADERS") - return [=] { return ScriptBase->getHeaderSize(); }; + return [=] { return elf::getHeaderSize(); }; // Tok is a literal number. uint64_t V; diff --git a/lld/ELF/LinkerScript.h b/lld/ELF/LinkerScript.h index abbe8a9e134c..a268f4fd1ce2 100644 --- a/lld/ELF/LinkerScript.h +++ b/lld/ELF/LinkerScript.h @@ -211,7 +211,6 @@ protected: OutputSection *Aether; public: - virtual uint64_t getHeaderSize() = 0; virtual uint64_t getSymbolValue(const Twine &Loc, StringRef S) = 0; uint64_t getDot() { return getSymbolValue("", "."); } virtual bool isDefined(StringRef S) = 0; @@ -266,7 +265,6 @@ public: void placeOrphanSections(); void assignAddresses(std::vector &Phdrs); bool hasPhdrsCommands(); - uint64_t getHeaderSize() override; uint64_t getSymbolValue(const Twine &Loc, StringRef S) override; bool isDefined(StringRef S) override; bool isAbsolute(StringRef S) override; diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp index 57b07e4d7424..c73d9b461a1d 100644 --- a/lld/ELF/OutputSections.cpp +++ b/lld/ELF/OutputSections.cpp @@ -389,6 +389,12 @@ bool DenseMapInfo::isEqual(const SectionKey &LHS, LHS.Flags == RHS.Flags && LHS.Alignment == RHS.Alignment; } +uint64_t elf::getHeaderSize() { + if (Config->OFormatBinary) + return 0; + return Out::ElfHeader->Size + Out::ProgramHeaders->Size; +} + namespace lld { namespace elf { diff --git a/lld/ELF/OutputSections.h b/lld/ELF/OutputSections.h index e23f740b65b0..72d3ccfeaf93 100644 --- a/lld/ELF/OutputSections.h +++ b/lld/ELF/OutputSections.h @@ -144,11 +144,7 @@ private: std::vector &OutputSections; }; -template uint64_t getHeaderSize() { - if (Config->OFormatBinary) - return 0; - return Out::ElfHeader->Size + Out::ProgramHeaders->Size; -} +uint64_t getHeaderSize(); } // namespace elf } // namespace lld diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index d3c3d043330d..aff04c8432b3 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -1443,7 +1443,7 @@ bool elf::allocateHeaders(std::vector &Phdrs, if (FirstPTLoad == Phdrs.end()) return false; - uint64_t HeaderSize = getHeaderSize(); + uint64_t HeaderSize = getHeaderSize(); if (HeaderSize > Min) { auto PhdrI = std::find_if(Phdrs.begin(), Phdrs.end(), @@ -1496,7 +1496,7 @@ template void Writer::fixHeaders() { template void Writer::assignAddresses() { uintX_t VA = Config->ImageBase; if (AllocateHeader) - VA += getHeaderSize(); + VA += getHeaderSize(); uintX_t ThreadBssOffset = 0; for (OutputSection *Sec : OutputSections) { uint32_t Alignment = Sec->Alignment;