diff options
author | Reid Kleckner <rnk@google.com> | 2018-05-17 20:47:22 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2018-05-17 20:47:22 +0000 |
commit | f40f85868e690eefc3bb65f030e5f7890d349794 (patch) | |
tree | bb04d9404c9065f113511b0ff14b273595c3e2e8 | |
parent | 0d8fa1b6fda2acf85f01ec550781ccd70a547967 (diff) | |
download | bcm5719-llvm-f40f85868e690eefc3bb65f030e5f7890d349794.tar.gz bcm5719-llvm-f40f85868e690eefc3bb65f030e5f7890d349794.zip |
[codeview] Include record prefix in global type hashing
The prefix includes type kind, which is important to preserve. Two
different type leafs can easily have the same interior record contents
as another type.
We ran into this issue in PR37492 where a bitfield type record collided
with a const modifier record. Their contents were bitwise identical, but
their kinds were different.
llvm-svn: 332664
-rw-r--r-- | lld/test/COFF/Inputs/pdb-hashes-1.yaml | 140 | ||||
-rw-r--r-- | lld/test/COFF/Inputs/pdb-hashes-2-missing.yaml | 45 | ||||
-rw-r--r-- | lld/test/COFF/Inputs/pdb-hashes-2.yaml | 77 | ||||
-rw-r--r-- | lld/test/COFF/pdb-global-hashes.test | 4 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/CodeView/TypeHashing.cpp | 1 | ||||
-rw-r--r-- | llvm/test/DebugInfo/COFF/global-type-hashes.ll | 55 | ||||
-rw-r--r-- | llvm/test/DebugInfo/COFF/pr37492.ll | 63 | ||||
-rw-r--r-- | llvm/test/DebugInfo/PDB/obj-globalhash.test | 22 |
8 files changed, 270 insertions, 137 deletions
diff --git a/lld/test/COFF/Inputs/pdb-hashes-1.yaml b/lld/test/COFF/Inputs/pdb-hashes-1.yaml index ba11ed1bf78..80670117489 100644 --- a/lld/test/COFF/Inputs/pdb-hashes-1.yaml +++ b/lld/test/COFF/Inputs/pdb-hashes-1.yaml @@ -6,7 +6,7 @@ sections: - Name: .text Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ] Alignment: 16 - SectionData: 5589E55683EC188B450C8B4D088D55F4C745F8000000008B7508894DF089D18934248945ECE80000000083EC048D4DF4890C248945E8E80000000083C4185E5DC3 + SectionData: 5589E55683EC188B450C8B4D08C745F8000000008B55088D75F4894DF089F18914248945ECE80000000083EC048D4DF4890C248945E8E80000000083C4185E5DC3 Relocations: - VirtualAddress: 38 SymbolName: '??0Foo@NS@@QAE@H@Z' @@ -33,7 +33,7 @@ sections: - Name: '.debug$S' Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ] Alignment: 4 - SectionData: 04000000F10000002F0000002D003C1101000000070006000000000000007017000000000000636C616E672076657273696F6E20362E302E30200000F50000008400000000000000000000004100000000000000080000000000000052000000070000000400000001000000400000000000000008000000000000007F0000000600040000000000030000003E000000000000000800000000000000BD0000000400040000000000040000003D000000000000000800000000000000FA0000000300080000000000F1000000960000002A00471100000000000000000000000041000000000000000000000003100000000000000000006D61696E000D003E1174000000010061726763001200451116000000080000001700000000002A000D003E11001000000100617267760012004511160000000C0000001700000000002A000A003E1109100000000066001200451116000000F4FFFFFF1700000000002A0002004F110000F200000030000000000000000000000041000000000000000300000024000000000000000300000017000000040000003000000005000000F1000000100000000E000811091000004E533A3A466F6F00F40000003000000001000000100165C9E387F88362A8EB2B49539DD5A65500002B00000010019303CF100D518DAF59C31DA01FEF4AFC0000F30000004801000000443A5C7372635C6C6C766D6275696C645C636C616E675C44656275675C7838365C6F626A312E63707000443A5C7372635C6C6C766D6275696C645C636C616E675C44656275675C7838365C6F626A2E6800245430202E7261536561726368203D202465697020245430205E203D2024657370202454302034202B203D2000245430202E7261536561726368203D202465697020245430205E203D2024657370202454302034202B203D2024656270202454302034202D205E203D200024543020246562702034202B203D202465697020245430205E203D2024657370202454302034202B203D2024656270202454302034202D205E203D200024543020246562702034202B203D202465697020245430205E203D2024657370202454302034202B203D2024656270202454302034202D205E203D2024657369202454302038202D205E203D2000 + SectionData: 04000000F10000002F0000002D003C110100000007000700000000000000581B000000000000636C616E672076657273696F6E20372E302E30200000F5000000840000000000000000000000410000000000000008000000000000004400000007000000040000000100000040000000000000000800000000000000710000000600040000000000030000003E000000000000000800000000000000AF0000000400040000000000040000003D000000000000000800000000000000EC0000000300080000000000F1000000960000002A00471100000000000000000000000041000000000000000000000003100000000000000000006D61696E000D003E1174000000010061726763001200451116000000080000001400000000002D000D003E11001000000100617267760012004511160000000C0000001400000000002D000A003E1109100000000066001200451116000000F4FFFFFF1400000000002D0002004F110000F200000030000000000000000000000041000000000000000300000024000000000000000400000014000000050000002D00000006000000F1000000100000000E000811091000004E533A3A466F6F00F4000000300000000100000010013469AC0DCAB9F1D7ED0FC4FA74E3983A0000240000001001C6036A3E7D29B0AB68FEE19A35B11BCD0000F30000003C01000000433A5C7372635C6C6C766D2D70726F6A6563745C6275696C645C6F626A312E63707000433A5C7372635C6C6C766D2D70726F6A6563745C6275696C645C6F626A2E6800245430202E7261536561726368203D202465697020245430205E203D2024657370202454302034202B203D2000245430202E7261536561726368203D202465697020245430205E203D2024657370202454302034202B203D2024656270202454302034202D205E203D200024543020246562702034202B203D202465697020245430205E203D2024657370202454302034202B203D2024656270202454302034202D205E203D200024543020246562702034202B203D202465697020245430205E203D2024657370202454302034202B203D2024656270202454302034202D205E203D2024657369202454302038202D205E203D20000000 Subsections: - !Symbols Records: @@ -41,15 +41,15 @@ sections: Compile3Sym: Flags: [ ] Machine: Pentium3 - FrontendMajor: 6 + FrontendMajor: 7 FrontendMinor: 0 FrontendBuild: 0 FrontendQFE: 0 - BackendMajor: 6000 + BackendMajor: 7000 BackendMinor: 0 BackendBuild: 0 BackendQFE: 0 - Version: 'clang version 6.0.0 ' + Version: 'clang version 7.0.0 ' - !FrameData Frames: - CodeSize: 65 @@ -99,16 +99,46 @@ sections: Type: 116 Flags: [ IsParameter ] VarName: argc + - Kind: S_DEFRANGE_REGISTER_REL + DefRangeRegisterRelSym: + Register: 22 + Flags: 0 + BasePointerOffset: 8 + Range: + OffsetStart: 20 + ISectStart: 0 + Range: 45 + Gaps: - Kind: S_LOCAL LocalSym: Type: 4096 Flags: [ IsParameter ] VarName: argv + - Kind: S_DEFRANGE_REGISTER_REL + DefRangeRegisterRelSym: + Register: 22 + Flags: 0 + BasePointerOffset: 12 + Range: + OffsetStart: 20 + ISectStart: 0 + Range: 45 + Gaps: - Kind: S_LOCAL LocalSym: Type: 4105 Flags: [ ] VarName: f + - Kind: S_DEFRANGE_REGISTER_REL + DefRangeRegisterRelSym: + Register: 22 + Flags: 0 + BasePointerOffset: -12 + Range: + OffsetStart: 20 + ISectStart: 0 + Range: 45 + Gaps: - Kind: S_PROC_ID_END ScopeEndSym: - !Lines @@ -117,20 +147,20 @@ sections: RelocOffset: 0 RelocSegment: 0 Blocks: - - FileName: 'D:\src\llvmbuild\clang\Debug\x86\obj1.cpp' + - FileName: 'C:\src\llvm-project\build\obj1.cpp' Lines: - Offset: 0 - LineStart: 3 - IsStatement: false - EndDelta: 0 - - Offset: 23 LineStart: 4 IsStatement: false EndDelta: 0 - - Offset: 48 + - Offset: 20 LineStart: 5 IsStatement: false EndDelta: 0 + - Offset: 45 + LineStart: 6 + IsStatement: false + EndDelta: 0 Columns: - !Symbols Records: @@ -140,20 +170,22 @@ sections: UDTName: 'NS::Foo' - !FileChecksums Checksums: - - FileName: 'D:\src\llvmbuild\clang\Debug\x86\obj1.cpp' + - FileName: 'C:\src\llvm-project\build\obj1.cpp' Kind: MD5 - Checksum: 65C9E387F88362A8EB2B49539DD5A655 - - FileName: 'D:\src\llvmbuild\clang\Debug\x86\obj.h' + Checksum: 3469AC0DCAB9F1D7ED0FC4FA74E3983A + - FileName: 'C:\src\llvm-project\build\obj.h' Kind: MD5 - Checksum: 9303CF100D518DAF59C31DA01FEF4AFC + Checksum: C6036A3E7D29B0AB68FEE19A35B11BCD - !StringTable Strings: - - 'D:\src\llvmbuild\clang\Debug\x86\obj1.cpp' - - 'D:\src\llvmbuild\clang\Debug\x86\obj.h' + - 'C:\src\llvm-project\build\obj1.cpp' + - 'C:\src\llvm-project\build\obj.h' - '$T0 .raSearch = $eip $T0 ^ = $esp $T0 4 + = ' - '$T0 .raSearch = $eip $T0 ^ = $esp $T0 4 + = $ebp $T0 4 - ^ = ' - '$T0 $ebp 4 + = $eip $T0 ^ = $esp $T0 4 + = $ebp $T0 4 - ^ = ' - '$T0 $ebp 4 + = $eip $T0 ^ = $esp $T0 4 + = $ebp $T0 4 - ^ = $esi $T0 8 - ^ = ' + - '' + - '' Relocations: - VirtualAddress: 68 SymbolName: _main @@ -191,7 +223,7 @@ sections: - Name: '.debug$T' Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ] Alignment: 4 - SectionData: 040000000A000210700400000A8000000E0001120200000074000000001000000E0008107400000000000200011000001200011600000000021000006D61696E00F3F2F12A0005150000800200000000000000000000000000004E533A3A466F6F002E3F4155466F6F404E53404000F10A000210041000000A8000000A00011201000000740000001A0009100300000004100000051000000B00010006100000000000001A0003120D15030074000000000058001115030007100000466F6F002A0005150200000208100000000000000000000004004E533A3A466F6F002E3F4155466F6F404E53404000F12E00051600000000443A5C7372635C6C6C766D6275696C645C636C616E675C44656275675C7838365C6F626A2E6800F10E000616091000000A100000020000000E0002160410000007100000466F6F00 + SectionData: 040000000A000210700400000A8000000E0001120200000074000000001000000E0008107400000000000200011000001200011600000000021000006D61696E00F3F2F12A0005150000800200000000000000000000000000004E533A3A466F6F002E3F4155466F6F404E53404000F10A000210041000000A8000000A00011201000000740000001A0009100300000004100000051000000B00010006100000000000001A0003120D15030074000000000058001115030007100000466F6F002A0005150200000208100000000000000000000004004E533A3A466F6F002E3F4155466F6F404E53404000F12600051600000000433A5C7372635C6C6C766D2D70726F6A6563745C6275696C645C6F626A2E68000E000616091000000A100000030000000E0002160410000007100000466F6F00 Types: - Kind: LF_POINTER Pointer: @@ -266,12 +298,12 @@ sections: - Kind: LF_STRING_ID StringId: Id: 0 - String: 'D:\src\llvmbuild\clang\Debug\x86\obj.h' + String: 'C:\src\llvm-project\build\obj.h' - Kind: LF_UDT_SRC_LINE UdtSourceLine: UDT: 4105 SourceFile: 4106 - LineNumber: 2 + LineNumber: 3 - Kind: LF_MFUNC_ID MemberFuncId: ClassType: 4100 @@ -280,28 +312,28 @@ sections: - Name: '.debug$H' Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ] Alignment: 4 - SectionData: C5C93301000000009E56666824DC4B12E25261D4E09E6E9DA0F4EE31FDEC3D2D96287486127C66070B248ED52E421F55074AE5CC2D68AF9F0A3BEF23993968F7FD82CA84BF0439C1A64C9070C6A6ADB0A34D21DAD0FFC3E99E616EF06A14EA74A2420F9062A1FB04917E5975E3A50EABE5E8FE3945468547C19DC681D0BFB3B797DD91CA4D7F1953C314442D5549419E78044E38A0BF16BFFAA5EE9C0103E7DBFE9941E63379C0B0C0A9021B711ACC4F67008974EBF441031BDD653F6935DFF3112C6A5346EF2AC94B9B7EB56EF55CFA0AF6C1846743F43D846BB19517E12E8873BBA90CC41DD1BEAC89CBA8897AC1BA46762E2557A82D894CEAE81AEF8680D723D403D9A4481F0E28683A98 + SectionData: C5C9330100000000624A7FEE7323656B7F1C5A63800309EE1ED8BB5B0EB2C87AD629AA9E5C98B7A3ED69DB1355707DF1624E463ACE08649D0FC35F163E20CC43089ADCA64B712C03EDA4CB88537EBAE4005A09006A9FB389476700689419512EFB395F1A23ADA4E788EB7A90DA146E89F004E6185E87867C58B4AC836CBBD1301D1BC1BDEEB7F3A86BB7ECCF6632585CDC7606E4CCAB0C6E6E190E3091E4290AFF7BA25E9E8209892CA91CCBF55A49FCB303335DC553B426E3AC635C1883F35475E9A4A12ED6396BC795E5D801DB74B371743A7A9E69529643FB49E2201DD99ECA4F72B2213D30B9768BAE6EB7C1150155B4421347349E771F26985B869638BAA4FE40A80C07611AAF09B6A4 GlobalHashes: Version: 0 HashAlgorithm: 0 HashValues: - - 9E56666824DC4B12E25261D4E09E6E9DA0F4EE31 - - FDEC3D2D96287486127C66070B248ED52E421F55 - - 074AE5CC2D68AF9F0A3BEF23993968F7FD82CA84 - - BF0439C1A64C9070C6A6ADB0A34D21DAD0FFC3E9 - - 9E616EF06A14EA74A2420F9062A1FB04917E5975 - - E3A50EABE5E8FE3945468547C19DC681D0BFB3B7 - - 97DD91CA4D7F1953C314442D5549419E78044E38 - - A0BF16BFFAA5EE9C0103E7DBFE9941E63379C0B0 - - C0A9021B711ACC4F67008974EBF441031BDD653F - - 6935DFF3112C6A5346EF2AC94B9B7EB56EF55CFA - - 0AF6C1846743F43D846BB19517E12E8873BBA90C - - C41DD1BEAC89CBA8897AC1BA46762E2557A82D89 - - 4CEAE81AEF8680D723D403D9A4481F0E28683A98 + - 624A7FEE7323656B7F1C5A63800309EE1ED8BB5B + - 0EB2C87AD629AA9E5C98B7A3ED69DB1355707DF1 + - 624E463ACE08649D0FC35F163E20CC43089ADCA6 + - 4B712C03EDA4CB88537EBAE4005A09006A9FB389 + - 476700689419512EFB395F1A23ADA4E788EB7A90 + - DA146E89F004E6185E87867C58B4AC836CBBD130 + - 1D1BC1BDEEB7F3A86BB7ECCF6632585CDC7606E4 + - CCAB0C6E6E190E3091E4290AFF7BA25E9E820989 + - 2CA91CCBF55A49FCB303335DC553B426E3AC635C + - 1883F35475E9A4A12ED6396BC795E5D801DB74B3 + - 71743A7A9E69529643FB49E2201DD99ECA4F72B2 + - 213D30B9768BAE6EB7C1150155B4421347349E77 + - 1F26985B869638BAA4FE40A80C07611AAF09B6A4 - Name: '.debug$S' Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ] Alignment: 4 - SectionData: 04000000F500000064000000000000000000000020000000000000000400000000000000520000000600000004000000010000001F0000000000000004000000000000007F0000000500040000000000030000001D000000000000000400000000000000BD0000000300040000000000F10000007B000000320047110000000000000000000000002000000000000000000000000C100000000000000000004E533A3A466F6F3A3A466F6F000D003E1105100000010074686973001200451116000000FCFFFFFF0F000000000011000A003E1174000000010078001200451116000000080000000F0000000000110002004F1100F2000000200000000000000000000000200000001800000001000000140000000000000003000000 + SectionData: 04000000F500000064000000000000000000000020000000000000000400000000000000440000000600000004000000010000001F000000000000000400000000000000710000000500040000000000030000001D000000000000000400000000000000AF0000000300040000000000F10000007B000000320047110000000000000000000000002000000000000000000000000C100000000000000000004E533A3A466F6F3A3A466F6F000D003E1105100000010074686973001200451116000000FCFFFFFF0F000000000011000A003E1174000000010078001200451116000000080000000F0000000000110002004F1100F2000000200000000000000000000000200000001800000001000000140000000000000004000000 Subsections: - !FrameData Frames: @@ -344,11 +376,31 @@ sections: Type: 4101 Flags: [ IsParameter ] VarName: this + - Kind: S_DEFRANGE_REGISTER_REL + DefRangeRegisterRelSym: + Register: 22 + Flags: 0 + BasePointerOffset: -4 + Range: + OffsetStart: 15 + ISectStart: 0 + Range: 17 + Gaps: - Kind: S_LOCAL LocalSym: Type: 116 Flags: [ IsParameter ] VarName: x + - Kind: S_DEFRANGE_REGISTER_REL + DefRangeRegisterRelSym: + Register: 22 + Flags: 0 + BasePointerOffset: 8 + Range: + OffsetStart: 15 + ISectStart: 0 + Range: 17 + Gaps: - Kind: S_PROC_ID_END ScopeEndSym: - !Lines @@ -357,10 +409,10 @@ sections: RelocOffset: 0 RelocSegment: 0 Blocks: - - FileName: 'D:\src\llvmbuild\clang\Debug\x86\obj.h' + - FileName: 'C:\src\llvm-project\build\obj.h' Lines: - Offset: 0 - LineStart: 3 + LineStart: 4 IsStatement: false EndDelta: 0 Columns: @@ -403,7 +455,7 @@ symbols: Length: 65 NumberOfRelocations: 2 NumberOfLinenumbers: 0 - CheckSum: 4176946275 + CheckSum: 1827148029 Number: 1 - Name: .data Value: 0 @@ -467,10 +519,10 @@ symbols: ComplexType: IMAGE_SYM_DTYPE_NULL StorageClass: IMAGE_SYM_CLASS_STATIC SectionDefinition: - Length: 832 + Length: 820 NumberOfRelocations: 11 NumberOfLinenumbers: 0 - CheckSum: 4106171226 + CheckSum: 3821266521 Number: 6 - Name: '.debug$S' Value: 0 @@ -482,7 +534,7 @@ symbols: Length: 284 NumberOfRelocations: 9 NumberOfLinenumbers: 0 - CheckSum: 1378739251 + CheckSum: 112499332 Number: 4 Selection: IMAGE_COMDAT_SELECT_ASSOCIATIVE - Name: '.debug$T' @@ -492,10 +544,10 @@ symbols: ComplexType: IMAGE_SYM_DTYPE_NULL StorageClass: IMAGE_SYM_CLASS_STATIC SectionDefinition: - Length: 316 + Length: 308 NumberOfRelocations: 0 NumberOfLinenumbers: 0 - CheckSum: 3343977630 + CheckSum: 2028313836 Number: 7 - Name: '.debug$H' Value: 0 @@ -507,7 +559,7 @@ symbols: Length: 268 NumberOfRelocations: 0 NumberOfLinenumbers: 0 - CheckSum: 3965031229 + CheckSum: 1115012461 Number: 8 - Name: '@feat.00' Value: 1 diff --git a/lld/test/COFF/Inputs/pdb-hashes-2-missing.yaml b/lld/test/COFF/Inputs/pdb-hashes-2-missing.yaml index 5b94d7fe592..aa715ee3104 100644 --- a/lld/test/COFF/Inputs/pdb-hashes-2-missing.yaml +++ b/lld/test/COFF/Inputs/pdb-hashes-2-missing.yaml @@ -22,7 +22,7 @@ sections: - Name: '.debug$S' Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ] Alignment: 4 - SectionData: 04000000F10000002F0000002D003C1101000000070006000000000000007017000000000000636C616E672076657273696F6E20362E302E30200000F5000000640000000000000000000000190000000000000004000000000000002B000000040000000400000001000000180000000000000004000000000000005800000003000400000000000300000016000000000000000400000000000000960000000100040000000000F1000000540000002E0047110000000000000000000000001900000000000000000000000D100000000000000000004E533A3A66756E63000A003E110310000001006600120045111600000008000000070000000000120002004F11F20000002800000000000000000000001900000000000000020000001C00000000000000030000000700000004000000F1000000100000000E0008110A1000004E533A3A466F6F00F40000001800000001000000100159DFAC75D18675AED1AD169FE316317E0000F3000000D400000000443A5C7372635C6C6C766D6275696C645C636C616E675C44656275675C7838365C6F626A322E63707000245430202E7261536561726368203D202465697020245430205E203D2024657370202454302034202B203D2000245430202E7261536561726368203D202465697020245430205E203D2024657370202454302034202B203D2024656270202454302034202D205E203D200024543020246562702034202B203D202465697020245430205E203D2024657370202454302034202B203D2024656270202454302034202D205E203D200000 + SectionData: 04000000F10000002F0000002D003C110100000007000700000000000000581B000000000000636C616E672076657273696F6E20372E302E30200000F500000064000000000000000000000019000000000000000400000000000000240000000400000004000000010000001800000000000000040000000000000051000000030004000000000003000000160000000000000004000000000000008F0000000100040000000000F1000000540000002E0047110000000000000000000000001900000000000000000000000D100000000000000000004E533A3A66756E63000A003E110310000001006600120045111600000008000000070000000000120002004F11F20000002800000000000000000000001900000000000000020000001C00000000000000040000000700000005000000F1000000100000000E0008110A1000004E533A3A466F6F00F400000018000000010000001001CEC8BDE31D126291115B63CE08A5D1360000F3000000CC00000000433A5C7372635C6C6C766D2D70726F6A6563745C6275696C645C6F626A322E63707000245430202E7261536561726368203D202465697020245430205E203D2024657370202454302034202B203D2000245430202E7261536561726368203D202465697020245430205E203D2024657370202454302034202B203D2024656270202454302034202D205E203D200024543020246562702034202B203D202465697020245430205E203D2024657370202454302034202B203D2024656270202454302034202D205E203D2000 Subsections: - !Symbols Records: @@ -30,15 +30,15 @@ sections: Compile3Sym: Flags: [ ] Machine: Pentium3 - FrontendMajor: 6 + FrontendMajor: 7 FrontendMinor: 0 FrontendBuild: 0 FrontendQFE: 0 - BackendMajor: 6000 + BackendMajor: 7000 BackendMinor: 0 BackendBuild: 0 BackendQFE: 0 - Version: 'clang version 6.0.0 ' + Version: 'clang version 7.0.0 ' - !FrameData Frames: - CodeSize: 25 @@ -80,6 +80,16 @@ sections: Type: 4099 Flags: [ IsParameter ] VarName: f + - Kind: S_DEFRANGE_REGISTER_REL + DefRangeRegisterRelSym: + Register: 22 + Flags: 0 + BasePointerOffset: 8 + Range: + OffsetStart: 7 + ISectStart: 0 + Range: 18 + Gaps: - Kind: S_PROC_ID_END ScopeEndSym: - !Lines @@ -88,14 +98,14 @@ sections: RelocOffset: 0 RelocSegment: 0 Blocks: - - FileName: 'D:\src\llvmbuild\clang\Debug\x86\obj2.cpp' + - FileName: 'C:\src\llvm-project\build\obj2.cpp' Lines: - Offset: 0 - LineStart: 3 + LineStart: 4 IsStatement: false EndDelta: 0 - Offset: 7 - LineStart: 4 + LineStart: 5 IsStatement: false EndDelta: 0 Columns: @@ -107,16 +117,15 @@ sections: UDTName: 'NS::Foo' - !FileChecksums Checksums: - - FileName: 'D:\src\llvmbuild\clang\Debug\x86\obj2.cpp' + - FileName: 'C:\src\llvm-project\build\obj2.cpp' Kind: MD5 - Checksum: 59DFAC75D18675AED1AD169FE316317E + Checksum: CEC8BDE31D126291115B63CE08A5D136 - !StringTable Strings: - - 'D:\src\llvmbuild\clang\Debug\x86\obj2.cpp' + - 'C:\src\llvm-project\build\obj2.cpp' - '$T0 .raSearch = $eip $T0 ^ = $esp $T0 4 + = ' - '$T0 .raSearch = $eip $T0 ^ = $esp $T0 4 + = $ebp $T0 4 - ^ = ' - '$T0 $ebp 4 + = $eip $T0 ^ = $esp $T0 4 + = $ebp $T0 4 - ^ = ' - - '' Relocations: - VirtualAddress: 68 SymbolName: '?func@NS@@YAHABUFoo@1@@Z' @@ -142,7 +151,7 @@ sections: - Name: '.debug$T' Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ] Alignment: 4 - SectionData: 040000000A000516000000004E5300F12A0005150000800200000000000000000000000000004E533A3A466F6F002E3F4155466F6F404E53404000F10A000110011000000100F2F10A000210021000002A8000000A00011201000000031000000E0008107400000000000100041000000A000210011000000A8000000A00011201000000740000001A0009100300000001100000061000000B00010007100000000000001A0003120D15030074000000000058001115030008100000466F6F002A0005150200000209100000000000000000000004004E533A3A466F6F002E3F4155466F6F404E53404000F12E00051600000000443A5C7372635C6C6C766D6275696C645C636C616E675C44656275675C7838365C6F626A2E6800F10E0006160A1000000B1000000200000012000116001000000510000066756E6300F3F2F1 + SectionData: 040000000A000516000000004E5300F12A0005150000800200000000000000000000000000004E533A3A466F6F002E3F4155466F6F404E53404000F10A000110011000000100F2F10A000210021000002A8000000A00011201000000031000000E0008107400000000000100041000000A000210011000000A8000000A00011201000000740000001A0009100300000001100000061000000B00010007100000000000001A0003120D15030074000000000058001115030008100000466F6F002A0005150200000209100000000000000000000004004E533A3A466F6F002E3F4155466F6F404E53404000F12600051600000000433A5C7372635C6C6C766D2D70726F6A6563745C6275696C645C6F626A2E68000E0006160A1000000B1000000300000012000116001000000510000066756E6300F3F2F1 Types: - Kind: LF_STRING_ID StringId: @@ -220,12 +229,12 @@ sections: - Kind: LF_STRING_ID StringId: Id: 0 - String: 'D:\src\llvmbuild\clang\Debug\x86\obj.h' + String: 'C:\src\llvm-project\build\obj.h' - Kind: LF_UDT_SRC_LINE UdtSourceLine: UDT: 4106 SourceFile: 4107 - LineNumber: 2 + LineNumber: 3 - Kind: LF_FUNC_ID FuncId: ParentScope: 4096 @@ -287,10 +296,10 @@ symbols: ComplexType: IMAGE_SYM_DTYPE_NULL StorageClass: IMAGE_SYM_CLASS_STATIC SectionDefinition: - Length: 584 + Length: 576 NumberOfRelocations: 7 NumberOfLinenumbers: 0 - CheckSum: 2847177244 + CheckSum: 1275848292 Number: 5 - Name: '.debug$T' Value: 0 @@ -299,10 +308,10 @@ symbols: ComplexType: IMAGE_SYM_DTYPE_NULL StorageClass: IMAGE_SYM_CLASS_STATIC SectionDefinition: - Length: 320 + Length: 312 NumberOfRelocations: 0 NumberOfLinenumbers: 0 - CheckSum: 2684556216 + CheckSum: 3001708198 Number: 6 - Name: '@feat.00' Value: 1 diff --git a/lld/test/COFF/Inputs/pdb-hashes-2.yaml b/lld/test/COFF/Inputs/pdb-hashes-2.yaml index 46676c485bc..597d360ef7e 100644 --- a/lld/test/COFF/Inputs/pdb-hashes-2.yaml +++ b/lld/test/COFF/Inputs/pdb-hashes-2.yaml @@ -22,7 +22,7 @@ sections: - Name: '.debug$S' Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ] Alignment: 4 - SectionData: 04000000F10000002F0000002D003C1101000000070006000000000000007017000000000000636C616E672076657273696F6E20362E302E30200000F5000000640000000000000000000000190000000000000004000000000000002B000000040000000400000001000000180000000000000004000000000000005800000003000400000000000300000016000000000000000400000000000000960000000100040000000000F1000000540000002E0047110000000000000000000000001900000000000000000000000D100000000000000000004E533A3A66756E63000A003E110310000001006600120045111600000008000000070000000000120002004F11F20000002800000000000000000000001900000000000000020000001C00000000000000030000000700000004000000F1000000100000000E0008110A1000004E533A3A466F6F00F40000001800000001000000100159DFAC75D18675AED1AD169FE316317E0000F3000000D400000000443A5C7372635C6C6C766D6275696C645C636C616E675C44656275675C7838365C6F626A322E63707000245430202E7261536561726368203D202465697020245430205E203D2024657370202454302034202B203D2000245430202E7261536561726368203D202465697020245430205E203D2024657370202454302034202B203D2024656270202454302034202D205E203D200024543020246562702034202B203D202465697020245430205E203D2024657370202454302034202B203D2024656270202454302034202D205E203D200000 + SectionData: 04000000F10000002F0000002D003C110100000007000700000000000000581B000000000000636C616E672076657273696F6E20372E302E30200000F500000064000000000000000000000019000000000000000400000000000000240000000400000004000000010000001800000000000000040000000000000051000000030004000000000003000000160000000000000004000000000000008F0000000100040000000000F1000000540000002E0047110000000000000000000000001900000000000000000000000D100000000000000000004E533A3A66756E63000A003E110310000001006600120045111600000008000000070000000000120002004F11F20000002800000000000000000000001900000000000000020000001C00000000000000040000000700000005000000F1000000100000000E0008110A1000004E533A3A466F6F00F400000018000000010000001001CEC8BDE31D126291115B63CE08A5D1360000F3000000CC00000000433A5C7372635C6C6C766D2D70726F6A6563745C6275696C645C6F626A322E63707000245430202E7261536561726368203D202465697020245430205E203D2024657370202454302034202B203D2000245430202E7261536561726368203D202465697020245430205E203D2024657370202454302034202B203D2024656270202454302034202D205E203D200024543020246562702034202B203D202465697020245430205E203D2024657370202454302034202B203D2024656270202454302034202D205E203D2000 Subsections: - !Symbols Records: @@ -30,15 +30,15 @@ sections: Compile3Sym: Flags: [ ] Machine: Pentium3 - FrontendMajor: 6 + FrontendMajor: 7 FrontendMinor: 0 FrontendBuild: 0 FrontendQFE: 0 - BackendMajor: 6000 + BackendMajor: 7000 BackendMinor: 0 BackendBuild: 0 BackendQFE: 0 - Version: 'clang version 6.0.0 ' + Version: 'clang version 7.0.0 ' - !FrameData Frames: - CodeSize: 25 @@ -80,6 +80,16 @@ sections: Type: 4099 Flags: [ IsParameter ] VarName: f + - Kind: S_DEFRANGE_REGISTER_REL + DefRangeRegisterRelSym: + Register: 22 + Flags: 0 + BasePointerOffset: 8 + Range: + OffsetStart: 7 + ISectStart: 0 + Range: 18 + Gaps: - Kind: S_PROC_ID_END ScopeEndSym: - !Lines @@ -88,14 +98,14 @@ sections: RelocOffset: 0 RelocSegment: 0 Blocks: - - FileName: 'D:\src\llvmbuild\clang\Debug\x86\obj2.cpp' + - FileName: 'C:\src\llvm-project\build\obj2.cpp' Lines: - Offset: 0 - LineStart: 3 + LineStart: 4 IsStatement: false EndDelta: 0 - Offset: 7 - LineStart: 4 + LineStart: 5 IsStatement: false EndDelta: 0 Columns: @@ -107,16 +117,15 @@ sections: UDTName: 'NS::Foo' - !FileChecksums Checksums: - - FileName: 'D:\src\llvmbuild\clang\Debug\x86\obj2.cpp' + - FileName: 'C:\src\llvm-project\build\obj2.cpp' Kind: MD5 - Checksum: 59DFAC75D18675AED1AD169FE316317E + Checksum: CEC8BDE31D126291115B63CE08A5D136 - !StringTable Strings: - - 'D:\src\llvmbuild\clang\Debug\x86\obj2.cpp' + - 'C:\src\llvm-project\build\obj2.cpp' - '$T0 .raSearch = $eip $T0 ^ = $esp $T0 4 + = ' - '$T0 .raSearch = $eip $T0 ^ = $esp $T0 4 + = $ebp $T0 4 - ^ = ' - '$T0 $ebp 4 + = $eip $T0 ^ = $esp $T0 4 + = $ebp $T0 4 - ^ = ' - - '' Relocations: - VirtualAddress: 68 SymbolName: '?func@NS@@YAHABUFoo@1@@Z' @@ -142,7 +151,7 @@ sections: - Name: '.debug$T' Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ] Alignment: 4 - SectionData: 040000000A000516000000004E5300F12A0005150000800200000000000000000000000000004E533A3A466F6F002E3F4155466F6F404E53404000F10A000110011000000100F2F10A000210021000002A8000000A00011201000000031000000E0008107400000000000100041000000A000210011000000A8000000A00011201000000740000001A0009100300000001100000061000000B00010007100000000000001A0003120D15030074000000000058001115030008100000466F6F002A0005150200000209100000000000000000000004004E533A3A466F6F002E3F4155466F6F404E53404000F12E00051600000000443A5C7372635C6C6C766D6275696C645C636C616E675C44656275675C7838365C6F626A2E6800F10E0006160A1000000B1000000200000012000116001000000510000066756E6300F3F2F1 + SectionData: 040000000A000516000000004E5300F12A0005150000800200000000000000000000000000004E533A3A466F6F002E3F4155466F6F404E53404000F10A000110011000000100F2F10A000210021000002A8000000A00011201000000031000000E0008107400000000000100041000000A000210011000000A8000000A00011201000000740000001A0009100300000001100000061000000B00010007100000000000001A0003120D15030074000000000058001115030008100000466F6F002A0005150200000209100000000000000000000004004E533A3A466F6F002E3F4155466F6F404E53404000F12600051600000000433A5C7372635C6C6C766D2D70726F6A6563745C6275696C645C6F626A2E68000E0006160A1000000B1000000300000012000116001000000510000066756E6300F3F2F1 Types: - Kind: LF_STRING_ID StringId: @@ -220,12 +229,12 @@ sections: - Kind: LF_STRING_ID StringId: Id: 0 - String: 'D:\src\llvmbuild\clang\Debug\x86\obj.h' + String: 'C:\src\llvm-project\build\obj.h' - Kind: LF_UDT_SRC_LINE UdtSourceLine: UDT: 4106 SourceFile: 4107 - LineNumber: 2 + LineNumber: 3 - Kind: LF_FUNC_ID FuncId: ParentScope: 4096 @@ -234,25 +243,25 @@ sections: - Name: '.debug$H' Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ] Alignment: 4 - SectionData: C5C9330100000000EC145CD76AEFE74E78880D531132B3BB8FFACEF79E616EF06A14EA74A2420F9062A1FB04917E59759949E334BA18509ED692F3C65CE242D8450EBC78B81B63AF8316DC324562EB9F0D4A0D708E8A25C263DB05943C19B84A36719E1E414DDA3EDBDF005322238D70F9058EEDC5C50EF11BC849618B51FD89E3A50EABE5E8FE3945468547C19DC681D0BFB3B797DD91CA4D7F1953C314442D5549419E78044E38A0BF16BFFAA5EE9C0103E7DBFE9941E63379C0B0C0A9021B711ACC4F67008974EBF441031BDD653F6935DFF3112C6A5346EF2AC94B9B7EB56EF55CFA0AF6C1846743F43D846BB19517E12E8873BBA90CC41DD1BEAC89CBA8897AC1BA46762E2557A82D89DCBC783AF285D9DBB672F67A81E36906B2038B57 + SectionData: C5C9330100000000D6242F1ED02B98E973DCA3334A061540B751965F476700689419512EFB395F1A23ADA4E788EB7A90DC6D1D00D355FEFEDDE4C68641D053622767E1526FD137C1525BDF80D746B3B9C314372C738054FC95D47092AC4D20BAC80E167B185331D42B388FB966A52D778FFF3829DC925A33C5CA6DD9A3EBA965DA146E89F004E6185E87867C58B4AC836CBBD1301D1BC1BDEEB7F3A86BB7ECCF6632585CDC7606E4CCAB0C6E6E190E3091E4290AFF7BA25E9E8209892CA91CCBF55A49FCB303335DC553B426E3AC635C1883F35475E9A4A12ED6396BC795E5D801DB74B371743A7A9E69529643FB49E2201DD99ECA4F72B2213D30B9768BAE6EB7C1150155B4421347349E77B1F380BB197127A54D0DB470E57DF96B15066C78 GlobalHashes: Version: 0 HashAlgorithm: 0 HashValues: - - EC145CD76AEFE74E78880D531132B3BB8FFACEF7 - - 9E616EF06A14EA74A2420F9062A1FB04917E5975 - - 9949E334BA18509ED692F3C65CE242D8450EBC78 - - B81B63AF8316DC324562EB9F0D4A0D708E8A25C2 - - 63DB05943C19B84A36719E1E414DDA3EDBDF0053 - - 22238D70F9058EEDC5C50EF11BC849618B51FD89 - - E3A50EABE5E8FE3945468547C19DC681D0BFB3B7 - - 97DD91CA4D7F1953C314442D5549419E78044E38 - - A0BF16BFFAA5EE9C0103E7DBFE9941E63379C0B0 - - C0A9021B711ACC4F67008974EBF441031BDD653F - - 6935DFF3112C6A5346EF2AC94B9B7EB56EF55CFA - - 0AF6C1846743F43D846BB19517E12E8873BBA90C - - C41DD1BEAC89CBA8897AC1BA46762E2557A82D89 - - DCBC783AF285D9DBB672F67A81E36906B2038B57 + - D6242F1ED02B98E973DCA3334A061540B751965F + - 476700689419512EFB395F1A23ADA4E788EB7A90 + - DC6D1D00D355FEFEDDE4C68641D053622767E152 + - 6FD137C1525BDF80D746B3B9C314372C738054FC + - 95D47092AC4D20BAC80E167B185331D42B388FB9 + - 66A52D778FFF3829DC925A33C5CA6DD9A3EBA965 + - DA146E89F004E6185E87867C58B4AC836CBBD130 + - 1D1BC1BDEEB7F3A86BB7ECCF6632585CDC7606E4 + - CCAB0C6E6E190E3091E4290AFF7BA25E9E820989 + - 2CA91CCBF55A49FCB303335DC553B426E3AC635C + - 1883F35475E9A4A12ED6396BC795E5D801DB74B3 + - 71743A7A9E69529643FB49E2201DD99ECA4F72B2 + - 213D30B9768BAE6EB7C1150155B4421347349E77 + - B1F380BB197127A54D0DB470E57DF96B15066C78 symbols: - Name: .text Value: 0 @@ -309,10 +318,10 @@ symbols: ComplexType: IMAGE_SYM_DTYPE_NULL StorageClass: IMAGE_SYM_CLASS_STATIC SectionDefinition: - Length: 584 + Length: 576 NumberOfRelocations: 7 NumberOfLinenumbers: 0 - CheckSum: 2847177244 + CheckSum: 1275848292 Number: 5 - Name: '.debug$T' Value: 0 @@ -321,10 +330,10 @@ symbols: ComplexType: IMAGE_SYM_DTYPE_NULL StorageClass: IMAGE_SYM_CLASS_STATIC SectionDefinition: - Length: 320 + Length: 312 NumberOfRelocations: 0 NumberOfLinenumbers: 0 - CheckSum: 2684556216 + CheckSum: 3001708198 Number: 6 - Name: '.debug$H' Value: 0 @@ -336,7 +345,7 @@ symbols: Length: 288 NumberOfRelocations: 0 NumberOfLinenumbers: 0 - CheckSum: 2348181452 + CheckSum: 3809286526 Number: 7 - Name: '@feat.00' Value: 1 diff --git a/lld/test/COFF/pdb-global-hashes.test b/lld/test/COFF/pdb-global-hashes.test index b47e4382653..ad2cbc3dc25 100644 --- a/lld/test/COFF/pdb-global-hashes.test +++ b/lld/test/COFF/pdb-global-hashes.test @@ -83,9 +83,9 @@ CHECK-NEXT: ============================================================ CHECK-NEXT: Showing 6 records CHECK-NEXT: 0x1000 | LF_FUNC_ID [size = 20] CHECK-NEXT: name = main, type = 0x1002, parent scope = <no type> -CHECK-NEXT: 0x1001 | LF_STRING_ID [size = 48] ID: <no type>, String: D:\src\llvmbuild\clang\Debug\x86\obj.h +CHECK-NEXT: 0x1001 | LF_STRING_ID [size = {{.*}}] ID: <no type>, String: {{.*}}obj.h CHECK-NEXT: 0x1002 | LF_UDT_SRC_LINE [size = 16] -CHECK-NEXT: udt = 0x1008, file = 4097, line = 2 +CHECK-NEXT: udt = 0x1008, file = 4097, line = 3 CHECK-NEXT: 0x1003 | LF_MFUNC_ID [size = 16] CHECK-NEXT: name = Foo, type = 0x1006, class type = 0x1003 CHECK-NEXT: 0x1004 | LF_STRING_ID [size = 12] ID: <no type>, String: NS diff --git a/llvm/lib/DebugInfo/CodeView/TypeHashing.cpp b/llvm/lib/DebugInfo/CodeView/TypeHashing.cpp index f5b28b2a207..c2f8cd5466a 100644 --- a/llvm/lib/DebugInfo/CodeView/TypeHashing.cpp +++ b/llvm/lib/DebugInfo/CodeView/TypeHashing.cpp @@ -39,6 +39,7 @@ GloballyHashedType::hashType(ArrayRef<uint8_t> RecordData, SHA1 S; S.init(); uint32_t Off = 0; + S.update(RecordData.take_front(sizeof(RecordPrefix))); RecordData = RecordData.drop_front(sizeof(RecordPrefix)); for (const auto &Ref : Refs) { // Hash any data that comes before this TiRef. diff --git a/llvm/test/DebugInfo/COFF/global-type-hashes.ll b/llvm/test/DebugInfo/COFF/global-type-hashes.ll index 2595c387fc9..99006a34543 100644 --- a/llvm/test/DebugInfo/COFF/global-type-hashes.ll +++ b/llvm/test/DebugInfo/COFF/global-type-hashes.ll @@ -275,23 +275,22 @@ attributes #2 = { noinline nounwind optnone "correctly-rounded-divide-sqrt-fp-ma ; YAML: Version: 0 ; YAML: HashAlgorithm: 0 ; YAML: HashValues: -; YAML: - 9E56666824DC4B12E25261D4E09E6E9DA0F4EE31 -; YAML: - FDEC3D2D96287486127C66070B248ED52E421F55 -; YAML: - 074AE5CC2D68AF9F0A3BEF23993968F7FD82CA84 -; YAML: - BF0439C1A64C9070C6A6ADB0A34D21DAD0FFC3E9 -; YAML: - CF1B3AD4A96BA628E6556FD28A222FBBEBBE140E -; YAML: - EC50195BFE148C0DC6A87A59D49CA1D9B146DB86 -; YAML: - 123C8BA63AD23386897AB6D814A9932F03846156 -; YAML: - 0F135243878289B83835BC2DB9EE25A1D4D0DA2B -; YAML: - 9069CA78E7450A285173431B3E52C5C25299E473 -; YAML: - ADA6E11350E9F2069D4689E3646C90D67B28DA62 -; YAML: - BD535FA9877A4DD123840AF849F3B0110EEB1D7A -; YAML: - 8044F70193FE40B71867158C5E50F0467485FA99 -; YAML: - 558606D57A76D125B705FC6DD18EEE3C1C0C4C09 -; YAML: - A64A018D9EB1EB8015917925662C8508D81CDA68 -; YAML: - 51E89AD9992AC6F11F9E3F1665F41C53BDA8AFC4 -; YAML: - 4F1C3BCA73099EF3466AAC99CC4951767DF890F5 -; ... +; YAML: - 624A7FEE7323656B7F1C5A63800309EE1ED8BB5B +; YAML: - 0EB2C87AD629AA9E5C98B7A3ED69DB1355707DF1 +; YAML: - 624E463ACE08649D0FC35F163E20CC43089ADCA6 +; YAML: - 4B712C03EDA4CB88537EBAE4005A09006A9FB389 +; YAML: - 59EC21C3D8D594FF77854ABAC324F82D24D22283 +; YAML: - DA76AFB7C767EC00BAA171FEFAA2801D95716C22 +; YAML: - 4927143F1D91A64983DDA6B6DDE23757322DB7C3 +; YAML: - DFDF871AD3841199ACD961EA57243C7A1305B4DD +; YAML: - 20015FA1AD3D0FF3546B4428D341E2F9BE57A1C7 +; YAML: - 8DC9D77BACDD53AAE3A5AC8F41C43D3C3122DCBC +; YAML: - 77A85205D34B9C26802849355086C2937E3F45D8 +; YAML: - 4AEF9C1D1509C0FFA2A02F86B3C28FB0F254096C +; YAML: - 83B03F51A4BABAE1E8B560B40634944401BCC520 +; YAML: - A82772A0D760F3EB5FC7A3022A6D376F5D7A92E2 +; YAML: - 235B46C1A3E3FB71D89ED6085E8B8D38632AACD6 +; YAML: - D52F03DB055DE93F19066E93FB3BA86C5A652429 ; ASM: .section .debug$H,"dr" @@ -299,14 +298,14 @@ attributes #2 = { noinline nounwind optnone "correctly-rounded-divide-sqrt-fp-ma ; ASM-NEXT: .long 20171205 # Magic ; ASM-NEXT: .short 0 # Section Version ; ASM-NEXT: .short 0 # Hash Algorithm -; ASM-NEXT: .byte 0x9e, 0x56, 0x66, 0x68 # 0x1000 [9E56666824DC4B12E25261D4E09E6E9DA0F4EE31] -; ASM-NEXT: .byte 0x24, 0xdc, 0x4b, 0x12 -; ASM-NEXT: .byte 0xe2, 0x52, 0x61, 0xd4 -; ASM-NEXT: .byte 0xe0, 0x9e, 0x6e, 0x9d -; ASM-NEXT: .byte 0xa0, 0xf4, 0xee, 0x31 -; ASM-NEXT: .byte 0xfd, 0xec, 0x3d, 0x2d # 0x1001 [FDEC3D2D96287486127C66070B248ED52E421F55] -; ASM-NEXT: .byte 0x96, 0x28, 0x74, 0x86 -; ASM-NEXT: .byte 0x12, 0x7c, 0x66, 0x07 -; ASM-NEXT: .byte 0x0b, 0x24, 0x8e, 0xd5 -; ASM-NEXT: .byte 0x2e, 0x42, 0x1f, 0x55 -; ASM-NEXT: .byte 0x07, 0x4a, 0xe5, 0xcc # 0x1002 [074AE5CC2D68AF9F0A3BEF23993968F7FD82CA84] +; ASM-NEXT: .byte 0x62, 0x4a, 0x7f, 0xee # 0x1000 [624A7FEE7323656B7F1C5A63800309EE1ED8BB5B] +; ASM-NEXT: .byte 0x73, 0x23, 0x65, 0x6b +; ASM-NEXT: .byte 0x7f, 0x1c, 0x5a, 0x63 +; ASM-NEXT: .byte 0x80, 0x03, 0x09, 0xee +; ASM-NEXT: .byte 0x1e, 0xd8, 0xbb, 0x5b +; ASM-NEXT: .byte 0x0e, 0xb2, 0xc8, 0x7a # 0x1001 [0EB2C87AD629AA9E5C98B7A3ED69DB1355707DF1] +; ASM-NEXT: .byte 0xd6, 0x29, 0xaa, 0x9e +; ASM-NEXT: .byte 0x5c, 0x98, 0xb7, 0xa3 +; ASM-NEXT: .byte 0xed, 0x69, 0xdb, 0x13 +; ASM-NEXT: .byte 0x55, 0x70, 0x7d, 0xf1 +; ASM-NEXT: .byte 0x62, 0x4e, 0x46, 0x3a # 0x1002 [624E463ACE08649D0FC35F163E20CC43089ADCA6] diff --git a/llvm/test/DebugInfo/COFF/pr37492.ll b/llvm/test/DebugInfo/COFF/pr37492.ll new file mode 100644 index 00000000000..7edff440b67 --- /dev/null +++ b/llvm/test/DebugInfo/COFF/pr37492.ll @@ -0,0 +1,63 @@ +; RUN: llc < %s | FileCheck %s + +; Original C++ source: +; struct Bits { +; unsigned char b0 : 1; +; unsigned char b1 : 1; +; } bits; +; const unsigned char *p_const; + +; In PR37492, there was an issue in global type hashing where we forgot to +; consider the prefix portion of a type record when hashing it. This lead to a +; collision between this LF_BITFIELD and LF_MODIFIER record, so we only emitted +; one under the assumption that the other was redundant. Check that we emit both. + +; CHECK-LABEL: # BitField ({{.*}}) { +; CHECK-NEXT: # TypeLeafKind: LF_BITFIELD (0x1205) +; CHECK-NEXT: # Type: unsigned char (0x20) +; CHECK-NEXT: # BitSize: 1 +; CHECK-NEXT: # BitOffset: 0 +; CHECK-NEXT: # } + +; CHECK-LABEL: # Modifier ({{.*}}) { +; CHECK-NEXT: # TypeLeafKind: LF_MODIFIER (0x1001) +; CHECK-NEXT: # ModifiedType: unsigned char (0x20) +; CHECK-NEXT: # Modifiers [ (0x1) +; CHECK-NEXT: # Const (0x1) +; CHECK-NEXT: # ] +; CHECK-NEXT: # } + +; ModuleID = 't.cpp' +source_filename = "t.cpp" +target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-pc-windows-msvc19.13.26131" + +%struct.Bits = type { i8 } + +@"?bits@@3UBits@@A" = dso_local global %struct.Bits zeroinitializer, align 1, !dbg !0 +@"?p_const@@3PEBEEB" = dso_local global i8* null, align 8, !dbg !6 + +!llvm.dbg.cu = !{!2} +!llvm.module.flags = !{!15, !16, !17, !18} +!llvm.ident = !{!19} + +!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) +!1 = distinct !DIGlobalVariable(name: "bits", linkageName: "?bits@@3UBits@@A", scope: !2, file: !3, line: 4, type: !11, isLocal: false, isDefinition: true) +!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 7.0.0 ", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5) +!3 = !DIFile(filename: "t.cpp", directory: "C:\5Csrc\5Cllvm-project\5Cbuild", checksumkind: CSK_MD5, checksum: "8910833bbe8b669a3787c8f44dff1313") +!4 = !{} +!5 = !{!0, !6} +!6 = !DIGlobalVariableExpression(var: !7, expr: !DIExpression()) +!7 = distinct !DIGlobalVariable(name: "p_const", linkageName: "?p_const@@3PEBEEB", scope: !2, file: !3, line: 5, type: !8, isLocal: false, isDefinition: true) +!8 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !9, size: 64) +!9 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !10) +!10 = !DIBasicType(name: "unsigned char", size: 8, encoding: DW_ATE_unsigned_char) +!11 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Bits", file: !3, line: 1, size: 8, flags: DIFlagTypePassByValue, elements: !12, identifier: ".?AUBits@@") +!12 = !{!13, !14} +!13 = !DIDerivedType(tag: DW_TAG_member, name: "b0", scope: !11, file: !3, line: 2, baseType: !10, size: 1, flags: DIFlagBitField, extraData: i64 0) +!14 = !DIDerivedType(tag: DW_TAG_member, name: "b1", scope: !11, file: !3, line: 3, baseType: !10, size: 1, offset: 1, flags: DIFlagBitField, extraData: i64 0) +!15 = !{i32 2, !"CodeView", i32 1} +!16 = !{i32 2, !"Debug Info Version", i32 3} +!17 = !{i32 1, !"wchar_size", i32 2} +!18 = !{i32 7, !"PIC Level", i32 2} +!19 = !{!"clang version 7.0.0 "} diff --git a/llvm/test/DebugInfo/PDB/obj-globalhash.test b/llvm/test/DebugInfo/PDB/obj-globalhash.test index 9bb6946050a..770eae2704a 100644 --- a/llvm/test/DebugInfo/PDB/obj-globalhash.test +++ b/llvm/test/DebugInfo/PDB/obj-globalhash.test @@ -14,41 +14,41 @@ RUN: cat %T/hashes-combined.out | FileCheck --check-prefix=CHECK-SIX %s ; char**. Both the local and global hashes should be the same, since the only ; back-references are for simple types which have fixed indices. CHECK-ONE: obj-hashes-1 -CHECK-ONE: TI: 0x1001, LocalHash: {{.*}}, GlobalHash: 8B2BA87CC27BF9D290A31A6070FA296AAA577E53 +CHECK-ONE: TI: 0x1001, LocalHash: {{.*}}, GlobalHash: 414E8FCAB16EC28AB86498D1A7F8CF106F39A384 CHECK-ONE: obj-hashes-2 -CHECK-ONE: TI: 0x1000, LocalHash: {{.*}}, GlobalHash: 8B2BA87CC27BF9D290A31A6070FA296AAA577E53 +CHECK-ONE: TI: 0x1000, LocalHash: {{.*}}, GlobalHash: 414E8FCAB16EC28AB86498D1A7F8CF106F39A384 ; int**. Same as char**, both the local and global hashes should be the same. CHECK-TWO: obj-hashes-1 -CHECK-TWO: TI: 0x1000, LocalHash: {{.*}}, GlobalHash: 1522A98D88FAF71B618D97BCAC2B89A424EC4805 +CHECK-TWO: TI: 0x1000, LocalHash: {{.*}}, GlobalHash: 91D2E2AD5D0F20EC1A24BE2E95D0616C5962F4B1 CHECK-TWO: obj-hashes-2 -CHECK-TWO: TI: 0x1002, LocalHash: {{.*}}, GlobalHash: 1522A98D88FAF71B618D97BCAC2B89A424EC4805 +CHECK-TWO: TI: 0x1002, LocalHash: {{.*}}, GlobalHash: 91D2E2AD5D0F20EC1A24BE2E95D0616C5962F4B1 ; int***. Different local hashes, since the referent type (int**) is not at the ; same TypeIndex in both streams. Same global hash, since they represent the ; same record. CHECK-THREE: obj-hashes-1 -CHECK-THREE: TI: 0x1002, LocalHash: {{.*}}, GlobalHash: EC11CE9F78D6BF61F8D913A9E2C98293782A7EB4 +CHECK-THREE: TI: 0x1002, LocalHash: {{.*}}, GlobalHash: 68A6DDB5C538D379E72E6425591A2B16352DF93D CHECK-THREE: obj-hashes-2 -CHECK-THREE: TI: 0x1001, LocalHash: {{.*}}, GlobalHash: EC11CE9F78D6BF61F8D913A9E2C98293782A7EB4 +CHECK-THREE: TI: 0x1001, LocalHash: {{.*}}, GlobalHash: 68A6DDB5C538D379E72E6425591A2B16352DF93D ; arg list (char**, int***). Different local hashes, since the parameter types ; both occur at different TypeIndices in their respective input streams. Same ; global hash, since the global hash of all referenced types is the same in ; both streams. CHECK-FOUR: obj-hashes-1 -CHECK-FOUR: TI: 0x1003, LocalHash: {{.*}}, GlobalHash: 1088AD64CEBC88D9E015058A159516AF20B79286 +CHECK-FOUR: TI: 0x1003, LocalHash: {{.*}}, GlobalHash: FD539365C0A8DEC0A1567C3E2F4C82E7AADB0E51 CHECK-FOUR: obj-hashes-2 -CHECK-FOUR: TI: 0x1004, LocalHash: {{.*}}, GlobalHash: 1088AD64CEBC88D9E015058A159516AF20B79286 +CHECK-FOUR: TI: 0x1004, LocalHash: {{.*}}, GlobalHash: FD539365C0A8DEC0A1567C3E2F4C82E7AADB0E51 ; double**. This is only in stream 2, as a means to throw off the indexing. CHECK-FIVE: obj-hashes-1 CHECK-FIVE: obj-hashes-2 -CHECK-FIVE: TI: 0x1003, LocalHash: {{.*}}, GlobalHash: 7803BBDB2947EF46BEA2310D102BD08F68315506 +CHECK-FIVE: TI: 0x1003, LocalHash: {{.*}}, GlobalHash: 5BB6926CA7924D06908872FA20691EA9B88584CC ; int** (char**, int***). For the same logic as described in previous records, ; these two records have the same global hash but different local hashes. CHECK-SIX: obj-hashes-1 -CHECK-SIX: TI: 0x1004, LocalHash: {{.*}}, GlobalHash: 457ABCB8AB70407594B5D72BF471B6BDECC99BC9 +CHECK-SIX: TI: 0x1004, LocalHash: {{.*}}, GlobalHash: 7A8576BA937B2E87BBF94A9CBFA8F993EE746065 CHECK-SIX: obj-hashes-2 -CHECK-SIX: TI: 0x1005, LocalHash: {{.*}}, GlobalHash: 457ABCB8AB70407594B5D72BF471B6BDECC99BC9 +CHECK-SIX: TI: 0x1005, LocalHash: {{.*}}, GlobalHash: 7A8576BA937B2E87BBF94A9CBFA8F993EE746065 |