[lld] r272984 - Rename Align -> Alignment.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 16 18:18:46 PDT 2016


Author: ruiu
Date: Thu Jun 16 20:18:46 2016
New Revision: 272984

URL: http://llvm.org/viewvc/llvm-project?rev=272984&view=rev
Log:
Rename Align -> Alignment.

I think it is me who named these variables, but I always find that
they are slightly confusing because align is a verb.
Adding four letters is worth it.

Modified:
    lld/trunk/ELF/InputSection.cpp
    lld/trunk/ELF/InputSection.h
    lld/trunk/ELF/LinkerScript.cpp
    lld/trunk/ELF/OutputSections.cpp
    lld/trunk/ELF/OutputSections.h
    lld/trunk/ELF/Relocations.cpp
    lld/trunk/ELF/Writer.cpp

Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=272984&r1=272983&r2=272984&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Thu Jun 16 20:18:46 2016
@@ -36,7 +36,7 @@ InputSectionBase<ELFT>::InputSectionBase
 
   // The ELF spec states that a value of 0 means the section has
   // no alignment constraits.
-  Align = std::max<uintX_t>(Header->sh_addralign, 1);
+  Alignment = std::max<uintX_t>(Header->sh_addralign, 1);
 }
 
 template <class ELFT> size_t InputSectionBase<ELFT>::getSize() const {
@@ -382,7 +382,7 @@ template <class ELFT> void InputSection<
 
 template <class ELFT>
 void InputSection<ELFT>::replace(InputSection<ELFT> *Other) {
-  this->Align = std::max(this->Align, Other->Align);
+  this->Alignment = std::max(this->Alignment, Other->Alignment);
   Other->Repl = this->Repl;
   Other->Live = false;
 }

Modified: lld/trunk/ELF/InputSection.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.h?rev=272984&r1=272983&r2=272984&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.h (original)
+++ lld/trunk/ELF/InputSection.h Thu Jun 16 20:18:46 2016
@@ -50,7 +50,7 @@ public:
   InputSectionBase(ObjectFile<ELFT> *File, const Elf_Shdr *Header,
                    Kind SectionKind);
   OutputSectionBase<ELFT> *OutSec = nullptr;
-  uint32_t Align;
+  uint32_t Alignment;
 
   // Used for garbage collection.
   bool Live;

Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=272984&r1=272983&r2=272984&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Thu Jun 16 20:18:46 2016
@@ -239,14 +239,14 @@ void LinkerScript<ELFT>::assignAddresses
 
       if ((Sec->getFlags() & SHF_TLS) && Sec->getType() == SHT_NOBITS) {
         uintX_t TVA = Dot + ThreadBssOffset;
-        TVA = alignTo(TVA, Sec->getAlign());
+        TVA = alignTo(TVA, Sec->getAlignment());
         Sec->setVA(TVA);
         ThreadBssOffset = TVA - Dot + Sec->getSize();
         continue;
       }
 
       if (Sec->getFlags() & SHF_ALLOC) {
-        Dot = alignTo(Dot, Sec->getAlign());
+        Dot = alignTo(Dot, Sec->getAlignment());
         Sec->setVA(Dot);
         Dot += Sec->getSize();
         continue;

Modified: lld/trunk/ELF/OutputSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=272984&r1=272983&r2=272984&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.cpp (original)
+++ lld/trunk/ELF/OutputSections.cpp Thu Jun 16 20:18:46 2016
@@ -781,7 +781,7 @@ void OutputSection<ELFT>::addSection(Inp
   auto *S = cast<InputSection<ELFT>>(C);
   Sections.push_back(S);
   S->OutSec = this;
-  this->updateAlign(S->Align);
+  this->updateAlignment(S->Alignment);
 }
 
 // If an input string is in the form of "foo.N" where N is a number,
@@ -1019,7 +1019,7 @@ template <class ELFT>
 void EhOutputSection<ELFT>::addSection(InputSectionBase<ELFT> *C) {
   auto *Sec = cast<EhInputSection<ELFT>>(C);
   Sec->OutSec = this;
-  this->updateAlign(Sec->Align);
+  this->updateAlignment(Sec->Alignment);
   Sections.push_back(Sec);
 
   // .eh_frame is a sequence of CIE or FDE records. This function
@@ -1160,7 +1160,7 @@ template <class ELFT>
 void MergeOutputSection<ELFT>::addSection(InputSectionBase<ELFT> *C) {
   auto *Sec = cast<MergeInputSection<ELFT>>(C);
   Sec->OutSec = this;
-  this->updateAlign(Sec->Align);
+  this->updateAlignment(Sec->Alignment);
   this->Header.sh_entsize = Sec->getSectionHdr()->sh_entsize;
   Sections.push_back(Sec);
 

Modified: lld/trunk/ELF/OutputSections.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.h?rev=272984&r1=272983&r2=272984&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.h (original)
+++ lld/trunk/ELF/OutputSections.h Thu Jun 16 20:18:46 2016
@@ -77,15 +77,15 @@ public:
   void setSize(uintX_t Val) { Header.sh_size = Val; }
   uintX_t getFlags() const { return Header.sh_flags; }
   uintX_t getFileOff() const { return Header.sh_offset; }
-  uintX_t getAlign() const {
+  uintX_t getAlignment() const {
     // The ELF spec states that a value of 0 means the section has no alignment
     // constraits.
     return std::max<uintX_t>(Header.sh_addralign, 1);
   }
   uint32_t getType() const { return Header.sh_type; }
-  void updateAlign(uintX_t Align) {
-    if (Align > Header.sh_addralign)
-      Header.sh_addralign = Align;
+  void updateAlignment(uintX_t Alignment) {
+    if (Alignment > Header.sh_addralign)
+      Header.sh_addralign = Alignment;
   }
 
   // If true, this section will be page aligned on disk.

Modified: lld/trunk/ELF/Relocations.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Relocations.cpp?rev=272984&r1=272983&r2=272984&view=diff
==============================================================================
--- lld/trunk/ELF/Relocations.cpp (original)
+++ lld/trunk/ELF/Relocations.cpp Thu Jun 16 20:18:46 2016
@@ -354,10 +354,10 @@ template <class ELFT> static void addCop
   if (SymSize == 0)
     fatal("cannot create a copy relocation for " + SS->getName());
 
-  uintX_t Align = getAlignment(SS);
-  uintX_t Off = alignTo(Out<ELFT>::Bss->getSize(), Align);
+  uintX_t Alignment = getAlignment(SS);
+  uintX_t Off = alignTo(Out<ELFT>::Bss->getSize(), Alignment);
   Out<ELFT>::Bss->setSize(Off + SymSize);
-  Out<ELFT>::Bss->updateAlign(Align);
+  Out<ELFT>::Bss->updateAlignment(Alignment);
   uintX_t Shndx = SS->Sym.st_shndx;
   uintX_t Value = SS->Sym.st_value;
   // Look through the DSO's dynamic symbol table for aliases and create a

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=272984&r1=272983&r2=272984&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Thu Jun 16 20:18:46 2016
@@ -124,7 +124,7 @@ template <class ELFT> void elf::writeRes
   OutputSectionBase<ELFT> ElfHeader("", 0, SHF_ALLOC);
   ElfHeader.setSize(sizeof(Elf_Ehdr));
   OutputSectionBase<ELFT> ProgramHeaders("", 0, SHF_ALLOC);
-  ProgramHeaders.updateAlign(sizeof(uintX_t));
+  ProgramHeaders.updateAlignment(sizeof(uintX_t));
 
   // Instantiate optional output sections if they are needed.
   std::unique_ptr<BuildIdSection<ELFT>> BuildId;
@@ -168,7 +168,7 @@ template <class ELFT> void elf::writeRes
     MipsRldMap.reset(new OutputSection<ELFT>(".rld_map", SHT_PROGBITS,
                                              SHF_ALLOC | SHF_WRITE));
     MipsRldMap->setSize(sizeof(uintX_t));
-    MipsRldMap->updateAlign(sizeof(uintX_t));
+    MipsRldMap->updateAlignment(sizeof(uintX_t));
   }
 
   Out<ELFT>::Bss = &Bss;
@@ -492,7 +492,7 @@ void Writer<ELFT>::addCommonSymbols(std:
   uintX_t Off = Out<ELFT>::Bss->getSize();
   for (DefinedCommon *C : Syms) {
     Off = alignTo(Off, C->Alignment);
-    Out<ELFT>::Bss->updateAlign(C->Alignment);
+    Out<ELFT>::Bss->updateAlignment(C->Alignment);
     C->OffsetInBss = Off;
     Off += C->Size;
   }
@@ -793,7 +793,7 @@ template <class ELFT> void Writer<ELFT>:
     Sec->forEachInputSection([&](InputSectionBase<ELFT> *S) {
       if (auto *IS = dyn_cast<InputSection<ELFT>>(S)) {
         // Set OutSecOff so that scanRelocations can use it.
-        uintX_t Off = alignTo(Sec->getSize(), S->Align);
+        uintX_t Off = alignTo(Sec->getSize(), S->Alignment);
         IS->OutSecOff = Off;
 
         scanRelocations(*IS);
@@ -1013,7 +1013,7 @@ template <class ELFT> void Writer<ELFT>:
     Hdr.Last = Sec;
     if (!Hdr.First)
       Hdr.First = Sec;
-    Hdr.H.p_align = std::max<uintX_t>(Hdr.H.p_align, Sec->getAlign());
+    Hdr.H.p_align = std::max<uintX_t>(Hdr.H.p_align, Sec->getAlignment());
   };
 
   // The first phdr entry is PT_PHDR which describes the program header itself.
@@ -1137,18 +1137,18 @@ template <class ELFT> void Writer<ELFT>:
 
   uintX_t ThreadBssOffset = 0;
   for (OutputSectionBase<ELFT> *Sec : OutputSections) {
-    uintX_t Align = Sec->getAlign();
+    uintX_t Alignment = Sec->getAlignment();
     if (Sec->PageAlign)
-      Align = std::max<uintX_t>(Align, Target->PageSize);
+      Alignment = std::max<uintX_t>(Alignment, Target->PageSize);
 
     // We only assign VAs to allocated sections.
     if (needsPtLoad<ELFT>(Sec)) {
-      VA = alignTo(VA, Align);
+      VA = alignTo(VA, Alignment);
       Sec->setVA(VA);
       VA += Sec->getSize();
     } else if (Sec->getFlags() & SHF_TLS && Sec->getType() == SHT_NOBITS) {
       uintX_t TVA = VA + ThreadBssOffset;
-      TVA = alignTo(TVA, Align);
+      TVA = alignTo(TVA, Alignment);
       Sec->setVA(TVA);
       ThreadBssOffset = TVA - VA + Sec->getSize();
     }
@@ -1161,10 +1161,10 @@ template <class ELFT> void Writer<ELFT>:
 // executables without any address adjustment.
 template <class ELFT, class uintX_t>
 static uintX_t getFileAlignment(uintX_t Off, OutputSectionBase<ELFT> *Sec) {
-  uintX_t Align = Sec->getAlign();
+  uintX_t Alignment = Sec->getAlignment();
   if (Sec->PageAlign)
-    Align = std::max<uintX_t>(Align, Target->PageSize);
-  Off = alignTo(Off, Align);
+    Alignment = std::max<uintX_t>(Alignment, Target->PageSize);
+  Off = alignTo(Off, Alignment);
 
   // Relocatable output does not have program headers
   // and does not need any other offset adjusting.




More information about the llvm-commits mailing list