Use uint64_t instead of uintX_t and size_t.
authorRui Ueyama <ruiu@google.com>
Wed, 29 Mar 2017 00:49:50 +0000 (00:49 +0000)
committerRui Ueyama <ruiu@google.com>
Wed, 29 Mar 2017 00:49:50 +0000 (00:49 +0000)
uint64_t is simpler and less error-prone than target or host-dependent types.

llvm-svn: 298969

lld/ELF/Relocations.cpp
lld/ELF/Symbols.h
lld/ELF/SyntheticSections.cpp
lld/ELF/SyntheticSections.h

index 84d93e7..5df6b18 100644 (file)
@@ -444,10 +444,8 @@ static std::vector<SharedSymbol *> getSymbolsAt(SharedSymbol *SS) {
 // 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 addCopyRelSymbol(SharedSymbol *SS) {
   // 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
index 88e83f9..372317b 100644 (file)
@@ -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 {
index a804de6..776a571 100644 (file)
@@ -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;
 }
 
index 32bd3db..0e0f1e4 100644 (file)
@@ -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 {