[lld] r315405 - Rename HasSections -> HasSectionsComand.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 10 18:34:51 PDT 2017


Author: ruiu
Date: Tue Oct 10 18:34:51 2017
New Revision: 315405

URL: http://llvm.org/viewvc/llvm-project?rev=315405&view=rev
Log:
Rename HasSections -> HasSectionsComand.

HasSections is true if there is at least one SECTIONS linker
script command, and it is not directly related to whether we have
section objects or not. So I think the new name is better.

Modified:
    lld/trunk/ELF/LinkerScript.cpp
    lld/trunk/ELF/LinkerScript.h
    lld/trunk/ELF/ScriptParser.cpp
    lld/trunk/ELF/Writer.cpp

Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=315405&r1=315404&r2=315405&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Tue Oct 10 18:34:51 2017
@@ -763,7 +763,7 @@ void LinkerScript::allocateHeaders(std::
   uint64_t HeaderSize = getHeaderSize();
   // When linker script with SECTIONS is being used, don't output headers
   // unless there's a space for them.
-  uint64_t Base = HasSections ? alignDown(Min, Config->MaxPageSize) : 0;
+  uint64_t Base = HasSectionsCommand ? alignDown(Min, Config->MaxPageSize) : 0;
   if (HeaderSize <= Min - Base || Script->hasPhdrsCommands()) {
     Min = alignDown(Min - HeaderSize, Config->MaxPageSize);
     Out::ElfHeader->Addr = Min;

Modified: lld/trunk/ELF/LinkerScript.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.h?rev=315405&r1=315404&r2=315405&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.h (original)
+++ lld/trunk/ELF/LinkerScript.h Tue Oct 10 18:34:51 2017
@@ -251,7 +251,7 @@ public:
   // PHDRS command list.
   std::vector<PhdrsCommand> PhdrsCommands;
 
-  bool HasSections = false;
+  bool HasSectionsCommand = false;
 
   // List of section patterns specified with KEEP commands. They will
   // be kept even if they are unused and --gc-sections is specified.

Modified: lld/trunk/ELF/ScriptParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/ScriptParser.cpp?rev=315405&r1=315404&r2=315405&view=diff
==============================================================================
--- lld/trunk/ELF/ScriptParser.cpp (original)
+++ lld/trunk/ELF/ScriptParser.cpp Tue Oct 10 18:34:51 2017
@@ -434,7 +434,7 @@ void ScriptParser::readSearchDir() {
 }
 
 void ScriptParser::readSections() {
-  Script->HasSections = true;
+  Script->HasSectionsCommand = true;
 
   // -no-rosegment is used to avoid placing read only non-executable sections in
   // their own segment. We do the same if SECTIONS command is present in linker

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=315405&r1=315404&r2=315405&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Tue Oct 10 18:34:51 2017
@@ -161,7 +161,7 @@ template <class ELFT> void Writer<ELFT>:
     addReservedSymbols();
 
   // Create output sections.
-  if (Script->HasSections) {
+  if (Script->HasSectionsCommand) {
     // If linker script contains SECTIONS commands, let it create sections.
     Script->processCommands(Factory);
 
@@ -813,7 +813,7 @@ template <class ELFT> void Writer<ELFT>:
     addOptionalRegular<ELFT>(Name, Out::ElfHeader, 0, STV_HIDDEN);
 
   // If linker script do layout we do not need to create any standart symbols.
-  if (Script->HasSections)
+  if (Script->HasSectionsCommand)
     return;
 
   auto Add = [](StringRef S, int64_t Pos) {
@@ -1055,7 +1055,7 @@ template <class ELFT> void Writer<ELFT>:
     if (auto *Sec = dyn_cast<OutputSection>(Base))
       Sec->SortRank = getSectionRank(Sec);
 
-  if (!Script->HasSections) {
+  if (!Script->HasSectionsCommand) {
     // We know that all the OutputSections are contiguous in
     // this case.
     auto E = Script->Commands.end();
@@ -1355,7 +1355,7 @@ template <class ELFT> void Writer<ELFT>:
                   InX::Dynamic},
                  [](SyntheticSection *SS) { SS->finalizeContents(); });
 
-  if (!Script->HasSections && !Config->Relocatable)
+  if (!Script->HasSectionsCommand && !Config->Relocatable)
     fixSectionAlignments();
 
   // Some architectures use small displacements for jump instructions.
@@ -1681,7 +1681,7 @@ template <class ELFT> void Writer<ELFT>:
 
   for (OutputSection *Sec : OutputSections) {
     Off = setOffset(Sec, Off);
-    if (Script->HasSections)
+    if (Script->HasSectionsCommand)
       continue;
     // If this is a last section of the last executable segment and that
     // segment is the last loadable segment, align the offset of the
@@ -1860,7 +1860,7 @@ static void fillTrap(uint8_t *I, uint8_t
 // We'll leave other pages in segments as-is because the rest will be
 // overwritten by output sections.
 template <class ELFT> void Writer<ELFT>::writeTrapInstr() {
-  if (Script->HasSections)
+  if (Script->HasSectionsCommand)
     return;
 
   // Fill the last page.




More information about the llvm-commits mailing list