[lld] r297622 - [ELF] - Remove unnecessary template. NFC.

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 13 08:09:11 PDT 2017


Thanks!
George Rimar via llvm-commits <llvm-commits at lists.llvm.org> writes:

> Author: grimar
> Date: Mon Mar 13 09:40:58 2017
> New Revision: 297622
>
> URL: http://llvm.org/viewvc/llvm-project?rev=297622&view=rev
> Log:
> [ELF] - Remove unnecessary template. NFC.
>
> Modified:
>     lld/trunk/ELF/LinkerScript.cpp
>     lld/trunk/ELF/LinkerScript.h
>     lld/trunk/ELF/OutputSections.cpp
>     lld/trunk/ELF/OutputSections.h
>     lld/trunk/ELF/Writer.cpp
>
> Modified: lld/trunk/ELF/LinkerScript.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=297622&r1=297621&r2=297622&view=diff
> ==============================================================================
> --- lld/trunk/ELF/LinkerScript.cpp (original)
> +++ lld/trunk/ELF/LinkerScript.cpp Mon Mar 13 09:40:58 2017
> @@ -932,10 +932,6 @@ uint64_t LinkerScript<ELFT>::getOutputSe
>    return 0;
>  }
>  
> -template <class ELFT> uint64_t LinkerScript<ELFT>::getHeaderSize() {
> -  return elf::getHeaderSize<ELFT>();
> -}
> -
>  template <class ELFT>
>  uint64_t LinkerScript<ELFT>::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;
>
> Modified: lld/trunk/ELF/LinkerScript.h
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.h?rev=297622&r1=297621&r2=297622&view=diff
> ==============================================================================
> --- lld/trunk/ELF/LinkerScript.h (original)
> +++ lld/trunk/ELF/LinkerScript.h Mon Mar 13 09:40:58 2017
> @@ -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<PhdrEntry> &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;
>
> Modified: lld/trunk/ELF/OutputSections.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=297622&r1=297621&r2=297622&view=diff
> ==============================================================================
> --- lld/trunk/ELF/OutputSections.cpp (original)
> +++ lld/trunk/ELF/OutputSections.cpp Mon Mar 13 09:40:58 2017
> @@ -389,6 +389,12 @@ bool DenseMapInfo<SectionKey>::isEqual(c
>           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 {
>  
>
> Modified: lld/trunk/ELF/OutputSections.h
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.h?rev=297622&r1=297621&r2=297622&view=diff
> ==============================================================================
> --- lld/trunk/ELF/OutputSections.h (original)
> +++ lld/trunk/ELF/OutputSections.h Mon Mar 13 09:40:58 2017
> @@ -144,11 +144,7 @@ private:
>    std::vector<OutputSection *> &OutputSections;
>  };
>  
> -template <class ELFT> uint64_t getHeaderSize() {
> -  if (Config->OFormatBinary)
> -    return 0;
> -  return Out::ElfHeader->Size + Out::ProgramHeaders->Size;
> -}
> +uint64_t getHeaderSize();
>  
>  } // namespace elf
>  } // namespace lld
>
> Modified: lld/trunk/ELF/Writer.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=297622&r1=297621&r2=297622&view=diff
> ==============================================================================
> --- lld/trunk/ELF/Writer.cpp (original)
> +++ lld/trunk/ELF/Writer.cpp Mon Mar 13 09:40:58 2017
> @@ -1443,7 +1443,7 @@ bool elf::allocateHeaders(std::vector<Ph
>    if (FirstPTLoad == Phdrs.end())
>      return false;
>  
> -  uint64_t HeaderSize = getHeaderSize<ELFT>();
> +  uint64_t HeaderSize = getHeaderSize();
>    if (HeaderSize > Min) {
>      auto PhdrI =
>          std::find_if(Phdrs.begin(), Phdrs.end(),
> @@ -1496,7 +1496,7 @@ template <class ELFT> void Writer<ELFT>:
>  template <class ELFT> void Writer<ELFT>::assignAddresses() {
>    uintX_t VA = Config->ImageBase;
>    if (AllocateHeader)
> -    VA += getHeaderSize<ELFT>();
> +    VA += getHeaderSize();
>    uintX_t ThreadBssOffset = 0;
>    for (OutputSection *Sec : OutputSections) {
>      uint32_t Alignment = Sec->Alignment;
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list