1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00

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

llvm-svn: 331537
This commit is contained in:
Peter Collingbourne 2018-05-04 16:28:41 +00:00
parent 54c7206423
commit 96cacec873
2 changed files with 17 additions and 1 deletions

View File

@ -0,0 +1,15 @@
# RUN: yaml2obj %s | obj2yaml | FileCheck %s
# CHECK: Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
# CHECK-NEXT: SectionData: '01'
--- !COFF
header:
Machine: IMAGE_FILE_MACHINE_AMD64
Characteristics: []
sections:
- Name: .rdata
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
SectionData: 01
symbols:
...

View File

@ -159,7 +159,8 @@ void COFFDumper::dumpSections(unsigned NumSections) {
NewYAMLSection.Header.PointerToRelocations =
COFFSection->PointerToRelocations;
NewYAMLSection.Header.SizeOfRawData = COFFSection->SizeOfRawData;
NewYAMLSection.Alignment = ObjSection.getAlignment();
uint32_t Shift = (COFFSection->Characteristics >> 20) & 0xF;
NewYAMLSection.Alignment = (1U << Shift) >> 1;
assert(NewYAMLSection.Alignment <= 8192);
ArrayRef<uint8_t> sectionData;