[lld] r298969 - Use uint64_t instead of uintX_t and size_t.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 28 17:49:51 PDT 2017


Author: ruiu
Date: Tue Mar 28 19:49:50 2017
New Revision: 298969

URL: http://llvm.org/viewvc/llvm-project?rev=298969&view=rev
Log:
Use uint64_t instead of uintX_t and size_t.

uint64_t is simpler and less error-prone than target or host-dependent types.

Modified:
    lld/trunk/ELF/Relocations.cpp
    lld/trunk/ELF/Symbols.h
    lld/trunk/ELF/SyntheticSections.cpp
    lld/trunk/ELF/SyntheticSections.h

Modified: lld/trunk/ELF/Relocations.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Relocations.cpp?rev=298969&r1=298968&r2=298969&view=diff
==============================================================================
--- lld/trunk/ELF/Relocations.cpp (original)
+++ lld/trunk/ELF/Relocations.cpp Tue Mar 28 19:49:50 2017
@@ -444,10 +444,8 @@ static std::vector<SharedSymbol *> getSy
 // debug. What's a solution? Instead of exporting a varaible V from a DSO,
 // define an accessor getV().
 template <class ELFT> static void addCopyRelSymbol(SharedSymbol *SS) {
-  typedef typename ELFT::uint uintX_t;
-
   // Copy relocation against zero-sized symbol doesn't make sense.
-  uintX_t SymSize = SS->template getSize<ELFT>();
+  uint64_t SymSize = SS->template getSize<ELFT>();
   if (SymSize == 0)
     fatal("cannot create a copy relocation for symbol " + toString(*SS));
 
@@ -455,7 +453,7 @@ template <class ELFT> static void addCop
   // memory protection by reserving space in the .bss.rel.ro section.
   bool IsReadOnly = isReadOnly<ELFT>(SS);
   BssSection *Sec = IsReadOnly ? In<ELFT>::BssRelRo : In<ELFT>::Bss;
-  uintX_t Off = Sec->reserveSpace(SymSize, SS->getAlignment<ELFT>());
+  uint64_t Off = Sec->reserveSpace(SymSize, SS->getAlignment<ELFT>());
 
   // Look through the DSO's dynamic symbol table for aliases and create a
   // dynamic symbol for each one. This causes the copy relocation to correctly

Modified: lld/trunk/ELF/Symbols.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.h?rev=298969&r1=298968&r2=298969&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.h (original)
+++ lld/trunk/ELF/Symbols.h Tue Mar 28 19:49:50 2017
@@ -240,7 +240,7 @@ public:
 
   // CopyRelSec and CopyRelSecOff are significant only when NeedsCopy is true.
   InputSection *CopyRelSec;
-  size_t CopyRelSecOff;
+  uint64_t CopyRelSecOff;
 
 private:
   template <class ELFT> const typename ELFT::Sym &getSym() const {

Modified: lld/trunk/ELF/SyntheticSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=298969&r1=298968&r2=298969&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.cpp (original)
+++ lld/trunk/ELF/SyntheticSections.cpp Tue Mar 28 19:49:50 2017
@@ -367,11 +367,11 @@ void BuildIdSection::computeHash(
 BssSection::BssSection(StringRef Name)
     : SyntheticSection(SHF_ALLOC | SHF_WRITE, SHT_NOBITS, 0, Name) {}
 
-size_t BssSection::reserveSpace(size_t Size, uint32_t Alignment) {
+size_t BssSection::reserveSpace(uint64_t Size, uint32_t Alignment) {
   if (OutSec)
     OutSec->updateAlignment(Alignment);
   this->Size = alignTo(this->Size, Alignment) + Size;
-  this->Alignment = std::max<uint32_t>(this->Alignment, Alignment);
+  this->Alignment = std::max(this->Alignment, Alignment);
   return this->Size - Size;
 }
 

Modified: lld/trunk/ELF/SyntheticSections.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.h?rev=298969&r1=298968&r2=298969&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.h (original)
+++ lld/trunk/ELF/SyntheticSections.h Tue Mar 28 19:49:50 2017
@@ -166,7 +166,7 @@ public:
   size_t getSize() const override { return Size; }
 
 private:
-  size_t Size = 0;
+  uint64_t Size = 0;
 };
 
 class MipsGotSection final : public SyntheticSection {




More information about the llvm-commits mailing list