[lld] r252739 - Replace size_t with uintX_t in a few places.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 11 07:40:38 PST 2015


Author: rafael
Date: Wed Nov 11 09:40:37 2015
New Revision: 252739

URL: http://llvm.org/viewvc/llvm-project?rev=252739&view=rev
Log:
Replace size_t with uintX_t in a few places.

If linking a 32 bit binary, these values must fit in 32 bits.

Modified:
    lld/trunk/ELF/InputSection.cpp
    lld/trunk/ELF/InputSection.h

Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=252739&r1=252738&r2=252739&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Wed Nov 11 09:40:37 2015
@@ -173,13 +173,13 @@ MergeInputSection<ELFT>::getOffset(uintX
       [](const uintX_t &A, const std::pair<uintX_t, size_t> &B) {
         return A < B.first;
       });
-  size_t End = I == Offsets.end() ? Data.size() : I->first;
+  uintX_t End = I == Offsets.end() ? Data.size() : I->first;
   --I;
   uintX_t Start = I->first;
 
   // Compute the Addend and if the Base is cached, return.
   uintX_t Addend = Offset - Start;
-  size_t &Base = I->second;
+  uintX_t &Base = I->second;
   if (Base != size_t(-1))
     return Base + Addend;
 

Modified: lld/trunk/ELF/InputSection.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.h?rev=252739&r1=252738&r2=252739&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.h (original)
+++ lld/trunk/ELF/InputSection.h Wed Nov 11 09:40:37 2015
@@ -90,7 +90,7 @@ template <class ELFT> class MergeInputSe
   typedef typename llvm::object::ELFFile<ELFT>::Elf_Shdr Elf_Shdr;
 
 public:
-  std::vector<std::pair<uintX_t, size_t>> Offsets;
+  std::vector<std::pair<uintX_t, uintX_t>> Offsets;
   MergeInputSection(ObjectFile<ELFT> *F, const Elf_Shdr *Header);
   static bool classof(const InputSectionBase<ELFT> *S);
   // Translate an offset in the input section to an offset in the output




More information about the llvm-commits mailing list