summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2016-09-02 18:43:27 +0000
committerReid Kleckner <rnk@google.com>2016-09-02 18:43:27 +0000
commitfa28396f97cc16d518f711a5c5f4bcf500e14ff2 (patch)
treeb2638a7035036e8ac8401f825584d4271e797eb4
parentbcdcbd11ba68649eb9c7579d7002f36907d3b9a9 (diff)
downloadbcm5719-llvm-fa28396f97cc16d518f711a5c5f4bcf500e14ff2.tar.gz
bcm5719-llvm-fa28396f97cc16d518f711a5c5f4bcf500e14ff2.zip
[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 llvm-svn: 280522
-rw-r--r--llvm/include/llvm/DebugInfo/CodeView/RecordSerialization.h4
-rw-r--r--llvm/lib/DebugInfo/CodeView/ListRecordBuilder.cpp9
-rw-r--r--llvm/test/DebugInfo/COFF/big-type.ll16
3 files changed, 17 insertions, 12 deletions
diff --git a/llvm/include/llvm/DebugInfo/CodeView/RecordSerialization.h b/llvm/include/llvm/DebugInfo/CodeView/RecordSerialization.h
index 6e3db34f26e..8b24086a664 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/RecordSerialization.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/RecordSerialization.h
@@ -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)
diff --git a/llvm/lib/DebugInfo/CodeView/ListRecordBuilder.cpp b/llvm/lib/DebugInfo/CodeView/ListRecordBuilder.cpp
index ab019c44c5b..efac32a0f86 100644
--- a/llvm/lib/DebugInfo/CodeView/ListRecordBuilder.cpp
+++ b/llvm/lib/DebugInfo/CodeView/ListRecordBuilder.cpp
@@ -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.
diff --git a/llvm/test/DebugInfo/COFF/big-type.ll b/llvm/test/DebugInfo/COFF/big-type.ll
index e83e94f86d5..ffce72e6cc5 100644
--- a/llvm/test/DebugInfo/COFF/big-type.ll
+++ b/llvm/test/DebugInfo/COFF/big-type.ll
@@ -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)
OpenPOWER on IntegriCloud