Change Metadata Index emission in the bitcode to use 2x32 bits for the placeholder

The Bitstream reader and writer are limited to handle a "size_t" at
most, which means that we can't backpatch and read back a 64bits
value on 32 bits platform.

llvm-svn: 290693
This commit is contained in:
Mehdi Amini
2016-12-28 23:45:54 +00:00
parent 6c37d298d9
commit 5022bb7238
3 changed files with 10 additions and 4 deletions

View File

@@ -1920,7 +1920,8 @@ void ModuleBitcodeWriter::writeModuleMetadata() {
BitCodeAbbrev *Abbv = new BitCodeAbbrev();
Abbv->Add(BitCodeAbbrevOp(bitc::METADATA_INDEX_OFFSET));
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 64));
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
unsigned OffsetAbbrev = Stream.EmitAbbrev(Abbv);
Abbv = new BitCodeAbbrev();
@@ -1939,7 +1940,7 @@ void ModuleBitcodeWriter::writeModuleMetadata() {
// which is written after the records, so that it can include
// the offset of each entry. The placeholder offset will be
// updated after all records are emitted.
uint64_t Vals[] = {0};
uint64_t Vals[] = {0, 0};
Stream.EmitRecord(bitc::METADATA_INDEX_OFFSET, Vals, OffsetAbbrev);
}