From 5022bb723853051a17d983322d30dfdac76d0914 Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Wed, 28 Dec 2016 23:45:54 +0000 Subject: 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 --- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'llvm/lib/Bitcode') diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index b7f753e1d62..c10ba2399e7 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -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); } -- cgit v1.2.3