llvm.org GIT mirror llvm / 64002dd
[yaml2obj/obj2yaml] - Support dumping/parsing ABI version. These tools were assuming ABI version is 0, that is not always true. Patch teaches them to work with that field. Differential revision: https://reviews.llvm.org/D55884 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349737 91177308-0d34-0410-b5e6-96231b3b80d8 George Rimar 8 months ago
5 changed file(s) with 20 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
6767 ELF_ELFCLASS Class;
6868 ELF_ELFDATA Data;
6969 ELF_ELFOSABI OSABI;
70 llvm::yaml::Hex8 ABIVersion;
7071 ELF_ET Type;
7172 ELF_EM Machine;
7273 ELF_EF Flags;
752752 IO.mapRequired("Class", FileHdr.Class);
753753 IO.mapRequired("Data", FileHdr.Data);
754754 IO.mapOptional("OSABI", FileHdr.OSABI, ELFYAML::ELF_ELFOSABI(0));
755 IO.mapOptional("ABIVersion", FileHdr.ABIVersion, Hex8(0));
755756 IO.mapRequired("Type", FileHdr.Type);
756757 IO.mapRequired("Machine", FileHdr.Machine);
757758 IO.mapOptional("Flags", FileHdr.Flags, ELFYAML::ELF_EF(0));
0 # RUN: yaml2obj %s -o %t
1 # RUN: llvm-readobj -file-headers %t | FileCheck %s --check-prefix=FROMYAML
2 # RUN: obj2yaml %t | FileCheck %s --check-prefix=TOYAML
3
4 ## Check we are able to parse/emit the ABI version with yaml2obj/obj2yaml.
5
6 # FROMYAML: ABIVersion: 5
7 # TOYAML: ABIVersion: 0x05
8
9 --- !ELF
10 FileHeader:
11 Class: ELFCLASS64
12 Data: ELFDATA2LSB
13 Type: ET_REL
14 Machine: EM_X86_64
15 ABIVersion: 0x05
113113 Y->Header.Class = ELFYAML::ELF_ELFCLASS(Obj.getHeader()->getFileClass());
114114 Y->Header.Data = ELFYAML::ELF_ELFDATA(Obj.getHeader()->getDataEncoding());
115115 Y->Header.OSABI = Obj.getHeader()->e_ident[ELF::EI_OSABI];
116 Y->Header.ABIVersion = Obj.getHeader()->e_ident[ELF::EI_ABIVERSION];
116117 Y->Header.Type = Obj.getHeader()->e_type;
117118 Y->Header.Machine = Obj.getHeader()->e_machine;
118119 Y->Header.Flags = Obj.getHeader()->e_flags;
195195 Header.e_ident[EI_DATA] = IsLittleEndian ? ELFDATA2LSB : ELFDATA2MSB;
196196 Header.e_ident[EI_VERSION] = EV_CURRENT;
197197 Header.e_ident[EI_OSABI] = Doc.Header.OSABI;
198 Header.e_ident[EI_ABIVERSION] = 0;
198 Header.e_ident[EI_ABIVERSION] = Doc.Header.ABIVersion;
199199 Header.e_type = Doc.Header.Type;
200200 Header.e_machine = Doc.Header.Machine;
201201 Header.e_version = EV_CURRENT;