llvm.org GIT mirror llvm / 97d37e8
[yaml2obj] Add support for sh_addralign via `AddressAlign` key. For consistency, change the address in the test case from 0xDEADBEEF to 0xCAFEBABE since 0xCAFEBABE that actually has a 2-byte alignment. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183962 91177308-0d34-0410-b5e6-96231b3b80d8 Sean Silva 7 years ago
4 changed file(s) with 7 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
5454 ELF_SHF Flags;
5555 llvm::yaml::Hex64 Address;
5656 object::yaml::BinaryRef Content;
57 llvm::yaml::Hex64 AddressAlign;
5758 };
5859 struct Object {
5960 FileHeader Header;
266266 IO.mapOptional("Flags", Section.Flags, ELFYAML::ELF_SHF(0));
267267 IO.mapOptional("Address", Section.Address, Hex64(0));
268268 IO.mapOptional("Content", Section.Content);
269 IO.mapOptional("AddressAlign", Section.AddressAlign, Hex64(0));
269270 }
270271
271272 void MappingTraits::mapping(IO &IO, ELFYAML::Object &Object) {
88 - Name: .text
99 Type: SHT_PROGBITS
1010 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
11 Address: 0xDEADBEEF
11 Address: 0xCAFEBABE
1212 Content: EBFE
13 AddressAlign: 2
1314
1415 # CHECK: Section {
1516 # CHECK: Index: 0
2223 # CHECK-NEXT: SHF_ALLOC (0x2)
2324 # CHECK-NEXT: SHF_EXECINSTR (0x4)
2425 # CHECK-NEXT: ]
25 # CHECK-NEXT: Address: 0xDEADBEEF
26 # CHECK-NEXT: Address: 0xCAFEBABE
2627 # CHECK: Size: 2
28 # CHECK: AddressAlignment: 2
2729 # CHECK: SectionData (
2830 # CHECK-NEXT: 0000: EBFE
2931 # CHECK-NEXT: )
160160
161161 SHeader.sh_link = 0;
162162 SHeader.sh_info = 0;
163 SHeader.sh_addralign = 1;
163 SHeader.sh_addralign = Sec.AddressAlign;
164164 SHeader.sh_entsize = 0;
165165 SHeaders.push_back(SHeader);
166166 }