[lld] r322416 - Do not pass an argument that can be easily inferred from other argument.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 12 14:29:29 PST 2018


Author: ruiu
Date: Fri Jan 12 14:29:29 2018
New Revision: 322416

URL: http://llvm.org/viewvc/llvm-project?rev=322416&view=rev
Log:
Do not pass an argument that can be easily inferred from other argument.

Modified:
    lld/trunk/ELF/SyntheticSections.cpp
    lld/trunk/ELF/SyntheticSections.h
    lld/trunk/ELF/Writer.cpp

Modified: lld/trunk/ELF/SyntheticSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=322416&r1=322415&r2=322416&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.cpp (original)
+++ lld/trunk/ELF/SyntheticSections.cpp Fri Jan 12 14:29:29 2018
@@ -1858,9 +1858,9 @@ void HashTableSection::writeTo(uint8_t *
   }
 }
 
-PltSection::PltSection(size_t HeaderSize, bool IsIplt)
+PltSection::PltSection(bool IsIplt)
     : SyntheticSection(SHF_ALLOC | SHF_EXECINSTR, SHT_PROGBITS, 16, ".plt"),
-      HeaderSize(HeaderSize), IsIplt(IsIplt) {
+      HeaderSize(IsIplt ? 0 : Target->PltHeaderSize), IsIplt(IsIplt) {
   // The PLT needs to be writable on SPARC as the dynamic linker will
   // modify the instructions in the PLT entries.
   if (Config->EMachine == EM_SPARCV9)

Modified: lld/trunk/ELF/SyntheticSections.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.h?rev=322416&r1=322415&r2=322416&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.h (original)
+++ lld/trunk/ELF/SyntheticSections.h Fri Jan 12 14:29:29 2018
@@ -493,7 +493,7 @@ private:
 // Target->IRelativeRel.
 class PltSection : public SyntheticSection {
 public:
-  PltSection(size_t HeaderSize, bool IsIplt);
+  PltSection(bool IsIplt);
   void writeTo(uint8_t *Buf) override;
   size_t getSize() const override;
   bool empty() const override { return Entries.empty(); }

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=322416&r1=322415&r2=322416&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Fri Jan 12 14:29:29 2018
@@ -369,9 +369,9 @@ template <class ELFT> static void create
       false /*Sort*/);
   Add(InX::RelaIplt);
 
-  InX::Plt = make<PltSection>(Target->PltHeaderSize, false /*IsIplt*/);
+  InX::Plt = make<PltSection>(false);
   Add(InX::Plt);
-  InX::Iplt = make<PltSection>(0 /*HeaderSize*/, true /*IsIplt*/);
+  InX::Iplt = make<PltSection>(true);
   Add(InX::Iplt);
 
   if (!Config->Relocatable) {




More information about the llvm-commits mailing list