[PDB] Fix failure on big endian machines.
authorZachary Turner <zturner@google.com>
Tue, 9 Oct 2018 17:58:51 +0000 (17:58 +0000)
committerZachary Turner <zturner@google.com>
Tue, 9 Oct 2018 17:58:51 +0000 (17:58 +0000)
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.

llvm-svn: 344063

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

index 97d8197..7f84564 100644 (file)
@@ -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;
 
index 786804b..b03c6c3 100644 (file)
@@ -121,7 +121,8 @@ static Error readGSIHashRecords(FixedStreamArray<PSHashRecord> &HashRecords,
 
 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))
index e94decc..7f309f4 100644 (file)
@@ -1708,11 +1708,6 @@ Error DumpOutputStyle::dumpSymbolsFromGSI(const GSIHashTable &Table,
 
   // 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);