Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CodeView] Align type records on 4-bytes when emitting PDBs
When emitting PDBs, the TypeStreamMerger class is used to merge .debug$T records from the input .OBJ files into the output .PDB stream. Records in .OBJs are not required to be aligned on 4-bytes, and "The Netwide Assembler 2.14" generates non-aligned records. When compiling with -DLLVM_ENABLE_ASSERTIONS=ON, an assert was triggered in MergingTypeTableBuilder when non-ghash merging was used. With ghash merging there was no assert. As a result, LLD could potentially generate a non-aligned TPI stream. We now align records on 4-bytes when record indices are remapped, in TypeStreamMerger::remapIndices(). Differential Revision: https://reviews.llvm.org/D75081 (cherry picked from commit a732529)
- Loading branch information
Showing
5 changed files
with
83 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# RUN: yaml2obj < %s > %t.obj | ||
# RUN: yaml2obj %p/Inputs/generic.yaml > %t2.obj | ||
|
||
# RUN: lld-link /out:%t.exe /debug /entry:main %t.obj %t2.obj /nodefaultlib | ||
# RUN: llvm-pdbutil dump --types --type-data %t.pdb | FileCheck %s | ||
# RUN: lld-link /out:%t.exe /debug:ghash /entry:main %t.obj %t2.obj /nodefaultlib | ||
# RUN: llvm-pdbutil dump --types --type-data %t.pdb | FileCheck %s | ||
|
||
# CHECK: 0000: 12000810 03000000 00000000 00000000 0000F2F1 | ||
|
||
--- !COFF | ||
header: | ||
Machine: IMAGE_FILE_MACHINE_AMD64 | ||
Characteristics: [] | ||
sections: | ||
- Name: '.debug$T' | ||
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ] | ||
Alignment: 1 | ||
# It is important to keep the 'SectionData' since the .OBJ is reconstructed from it, | ||
# and that triggers an alignement bug in the output .PDB. | ||
SectionData: '040000001000081003000000000000000000000000000600011200000000' | ||
Types: | ||
- Kind: LF_PROCEDURE | ||
Procedure: | ||
ReturnType: 3 | ||
CallConv: NearC | ||
Options: [ None ] | ||
ParameterCount: 0 | ||
ArgumentList: 0 | ||
- Kind: LF_ARGLIST | ||
ArgList: | ||
ArgIndices: [ ] | ||
symbols: | ||
- Name: '.debug$T' | ||
Value: 0 | ||
SectionNumber: 1 | ||
SimpleType: IMAGE_SYM_TYPE_NULL | ||
ComplexType: IMAGE_SYM_DTYPE_NULL | ||
StorageClass: IMAGE_SYM_CLASS_STATIC | ||
SectionDefinition: | ||
Length: 30 | ||
NumberOfRelocations: 0 | ||
NumberOfLinenumbers: 0 | ||
CheckSum: 0 | ||
Number: 0 | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters