[codeview] Use the correct max CV record length of 0xFF00

Previously we were splitting our records at 0xFFFF bytes, which the
Microsoft tools don't like.

Should fix failure on the new Windows self-host buildbot.

This length appears in microsoft-pdb/PDB/dbi/dbiimpl.h

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280522 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Reid Kleckner 2016-09-02 18:43:27 +00:00
parent 482ae0ae47
commit 740c3d2411
3 changed files with 17 additions and 12 deletions

View File

@ -26,6 +26,10 @@ using llvm::support::little32_t;
using llvm::support::ulittle16_t;
using llvm::support::ulittle32_t;
/// Limit on the size of all codeview symbol and type records, including the
/// RecordPrefix. MSVC does not emit any records larger than this.
enum : unsigned { MaxRecordLength = 0xFF00 };
struct RecordPrefix {
ulittle16_t RecordLen; // Record length, starting from &Leaf.
ulittle16_t RecordKind; // Record kind enum (SymRecordKind or TypeRecordKind)

View File

@ -20,7 +20,7 @@ ListRecordBuilder::ListRecordBuilder(TypeRecordKind Kind)
void ListRecordBuilder::writeMemberType(const ListContinuationRecord &R) {
TypeRecordBuilder &Builder = getBuilder();
assert(getLastContinuationSize() < 65535 - 8 && "continuation won't fit");
assert(getLastContinuationSize() < MaxRecordLength - 8 && "continuation won't fit");
Builder.writeTypeRecordKind(TypeRecordKind::ListContinuation);
Builder.writeUInt16(0);
@ -48,11 +48,12 @@ void ListRecordBuilder::finishSubRecord() {
// space for a continuation record (8 bytes). If the segment does not fit,
// back up and insert a continuation record, sliding the current subrecord
// down.
if (getLastContinuationSize() > 65535 - 8) {
if (getLastContinuationSize() > MaxRecordLength - 8) {
assert(SubrecordStart != 0 && "can't slide from the start!");
SmallString<128> SubrecordCopy(
Builder.str().slice(SubrecordStart, Builder.size()));
assert(SubrecordCopy.size() < 65530 && "subrecord is too large to slide!");
assert(SubrecordCopy.size() < MaxRecordLength - 8 &&
"subrecord is too large to slide!");
Builder.truncate(SubrecordStart);
// Write a placeholder continuation record.
@ -61,7 +62,7 @@ void ListRecordBuilder::finishSubRecord() {
Builder.writeUInt32(0);
ContinuationOffsets.push_back(Builder.size());
assert(Builder.size() == SubrecordStart + 8 && "wrong continuation size");
assert(getLastContinuationSize() < 65535 && "segment too big");
assert(getLastContinuationSize() < MaxRecordLength && "segment too big");
// Start a new list record of the appropriate kind, and copy the previous
// subrecord into place.

View File

@ -7,8 +7,8 @@
; CHECK-NEXT: Enumerator {
; CHECK-NEXT: TypeLeafKind: LF_ENUMERATE (0x1502)
; CHECK-NEXT: AccessSpecifier: Public (0x3)
; CHECK-NEXT: EnumValue: 5460
; CHECK-NEXT: Name: EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE5461
; CHECK-NEXT: EnumValue: 5436
; CHECK-NEXT: Name: EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE5437
; CHECK-NEXT: }
; CHECK-NOT: ContinuationIndex
@ -17,8 +17,8 @@
; CHECK-NEXT: Enumerator {
; CHECK-NEXT: TypeLeafKind: LF_ENUMERATE (0x1502)
; CHECK-NEXT: AccessSpecifier: Public (0x3)
; CHECK-NEXT: EnumValue: 4095
; CHECK-NEXT: Name: EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE4096
; CHECK-NEXT: EnumValue: 4077
; CHECK-NEXT: Name: EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE4078
; CHECK-NEXT: }
; CHECK: ContinuationIndex: <field list> (0x1000)
@ -27,8 +27,8 @@
; CHECK-NEXT: Enumerator {
; CHECK-NEXT: TypeLeafKind: LF_ENUMERATE (0x1502)
; CHECK-NEXT: AccessSpecifier: Public (0x3)
; CHECK-NEXT: EnumValue: 2730
; CHECK-NEXT: Name: EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE2731
; CHECK-NEXT: EnumValue: 2718
; CHECK-NEXT: Name: EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE2719
; CHECK-NEXT: }
; CHECK: ContinuationIndex: <field list> (0x1001)
@ -37,8 +37,8 @@
; CHECK-NEXT: Enumerator {
; CHECK-NEXT: TypeLeafKind: LF_ENUMERATE (0x1502)
; CHECK-NEXT: AccessSpecifier: Public (0x3)
; CHECK-NEXT: EnumValue: 1365
; CHECK-NEXT: Name: EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE1366
; CHECK-NEXT: EnumValue: 1359
; CHECK-NEXT: Name: EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE1360
; CHECK-NEXT: }
; CHECK: ContinuationIndex: <field list> (0x1002)