[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.

llvm-svn: 344063
This commit is contained in:
Zachary Turner 2018-10-09 17:58:51 +00:00
parent c2921f002e
commit b7dd12b7a8
3 changed files with 3 additions and 7 deletions

View 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;

View 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))

View 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);