[llvm] r344063 - [PDB] Fix failure on big endian machines.

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 9 10:58:52 PDT 2018


Author: zturner
Date: Tue Oct  9 10:58:51 2018
New Revision: 344063

URL: http://llvm.org/viewvc/llvm-project?rev=344063&view=rev
Log:
[PDB] Fix failure on big endian machines.

We changed an ArrayRef<uint8_t> to an ArrayRef<uint32_t>, but
it needs to be an ArrayRef<support::ulittle32_t>.

We also change ArrayRef<> to FixedStreamArray<>.  Technically
an ArrayRef<> will work, but it can cause a copy in the underlying
implementation if the memory is not contiguous, and there's no
reason not to use a FixedStreamArray<>.

Thanks to nemanjai@ and thakis@ for helping me track this down
and confirm the fix.

Modified:
    llvm/trunk/include/llvm/DebugInfo/PDB/Native/GlobalsStream.h
    llvm/trunk/lib/DebugInfo/PDB/Native/GlobalsStream.cpp
    llvm/trunk/tools/llvm-pdbutil/DumpOutputStyle.cpp

Modified: llvm/trunk/include/llvm/DebugInfo/PDB/Native/GlobalsStream.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Native/GlobalsStream.h?rev=344063&r1=344062&r2=344063&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/Native/GlobalsStream.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/Native/GlobalsStream.h Tue Oct  9 10:58:51 2018
@@ -52,7 +52,7 @@ class GSIHashTable {
 public:
   const GSIHashHeader *HashHdr;
   FixedStreamArray<PSHashRecord> HashRecords;
-  ArrayRef<uint32_t> HashBitmap;
+  FixedStreamArray<support::ulittle32_t> HashBitmap;
   FixedStreamArray<support::ulittle32_t> HashBuckets;
   std::array<int32_t, IPHR_HASH + 1> BucketMap;
 

Modified: llvm/trunk/lib/DebugInfo/PDB/Native/GlobalsStream.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Native/GlobalsStream.cpp?rev=344063&r1=344062&r2=344063&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Native/GlobalsStream.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Native/GlobalsStream.cpp Tue Oct  9 10:58:51 2018
@@ -121,7 +121,8 @@ static Error readGSIHashRecords(FixedStr
 
 static Error
 readGSIHashBuckets(FixedStreamArray<support::ulittle32_t> &HashBuckets,
-                   ArrayRef<uint32_t> &HashBitmap, const GSIHashHeader *HashHdr,
+                   FixedStreamArray<support::ulittle32_t> &HashBitmap,
+                   const GSIHashHeader *HashHdr,
                    MutableArrayRef<int32_t> BucketMap,
                    BinaryStreamReader &Reader) {
   if (auto EC = checkHashHdrVersion(HashHdr))

Modified: llvm/trunk/tools/llvm-pdbutil/DumpOutputStyle.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbutil/DumpOutputStyle.cpp?rev=344063&r1=344062&r2=344063&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-pdbutil/DumpOutputStyle.cpp (original)
+++ llvm/trunk/tools/llvm-pdbutil/DumpOutputStyle.cpp Tue Oct  9 10:58:51 2018
@@ -1708,11 +1708,6 @@ Error DumpOutputStyle::dumpSymbolsFromGS
 
   // Return early if we aren't dumping public hash table and address map info.
   if (HashExtras) {
-    ArrayRef<uint8_t> BitmapBytes(
-        reinterpret_cast<const uint8_t *>(Table.HashBitmap.data()),
-        Table.HashBitmap.size() * sizeof(uint32_t));
-    P.formatBinary("Hash Bitmap", BitmapBytes, 0);
-
     P.formatLine("Hash Entries");
     {
       AutoIndent Indent2(P);




More information about the llvm-commits mailing list