llvm.org GIT mirror llvm / c0d9a0b
obj2yaml: Correctly round-trip default alignment. Previously we were emitting the "cooked" alignment, which made it hard to distinguish between that and the default alignment. Differential Revision: https://reviews.llvm.org/D46418 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331537 91177308-0d34-0410-b5e6-96231b3b80d8 Peter Collingbourne 1 year, 3 months ago
2 changed file(s) with 17 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
0 # RUN: yaml2obj %s | obj2yaml | FileCheck %s
1
2 # CHECK: Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
3 # CHECK-NEXT: SectionData: '01'
4
5 --- !COFF
6 header:
7 Machine: IMAGE_FILE_MACHINE_AMD64
8 Characteristics: []
9 sections:
10 - Name: .rdata
11 Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
12 SectionData: 01
13 symbols:
14 ...
158158 NewYAMLSection.Header.PointerToRelocations =
159159 COFFSection->PointerToRelocations;
160160 NewYAMLSection.Header.SizeOfRawData = COFFSection->SizeOfRawData;
161 NewYAMLSection.Alignment = ObjSection.getAlignment();
161 uint32_t Shift = (COFFSection->Characteristics >> 20) & 0xF;
162 NewYAMLSection.Alignment = (1U << Shift) >> 1;
162163 assert(NewYAMLSection.Alignment <= 8192);
163164
164165 ArrayRef sectionData;