Fix narrowing conversion error in 32-bit MSVC builds
authorReid Kleckner <rnk@google.com>
Thu, 20 Oct 2016 00:13:34 +0000 (00:13 +0000)
committerReid Kleckner <rnk@google.com>
Thu, 20 Oct 2016 00:13:34 +0000 (00:13 +0000)
Use size_t instead of ELFT::uint for the string table offset. If the
linker is built 32-bit, it can't write an output file larger than 2GB.
Other code in this area uses size_t as well.

llvm-svn: 284680

lld/ELF/OutputSections.cpp
lld/ELF/OutputSections.h

index 06c9de8..90561bc 100644 (file)
@@ -633,7 +633,7 @@ void GnuHashTableSection<ELFT>::addSymbols(std::vector<SymbolTableEntry> &V) {
     return;
   for (auto I = Mid, E = V.end(); I != E; ++I) {
     SymbolBody *B = I->Symbol;
-    typename ELFT::uint StrOff = I->StrTabOffset;
+    size_t StrOff = I->StrTabOffset;
     Symbols.push_back({B, StrOff, hashGnu(B->getName())});
   }
 
index f73c418..f5a5270 100644 (file)
@@ -266,7 +266,7 @@ private:
 
 struct SymbolTableEntry {
   SymbolBody *Symbol;
-  std::size_t StrTabOffset;
+  size_t StrTabOffset;
 };
 
 template <class ELFT>