diff options
author | Chris Bieneman <beanz@apple.com> | 2016-05-17 21:31:02 +0000 |
---|---|---|
committer | Chris Bieneman <beanz@apple.com> | 2016-05-17 21:31:02 +0000 |
commit | 7b504b75312ec0a02f20aba47d59e254f76d2e56 (patch) | |
tree | d993365a431d4cd4682ef0fb2c001d10b651965a /llvm/lib/ObjectYAML/MachOYAML.cpp | |
parent | e3ec688df598f3ff052776b72a9f4601838a2d1a (diff) | |
download | bcm5719-llvm-7b504b75312ec0a02f20aba47d59e254f76d2e56.tar.gz bcm5719-llvm-7b504b75312ec0a02f20aba47d59e254f76d2e56.zip |
[obj2yaml] [yaml2obj] Support MachO section and section_64 structs
This patch adds round trip support for MachO section structs.
llvm-svn: 269845
Diffstat (limited to 'llvm/lib/ObjectYAML/MachOYAML.cpp')
-rw-r--r-- | llvm/lib/ObjectYAML/MachOYAML.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/lib/ObjectYAML/MachOYAML.cpp b/llvm/lib/ObjectYAML/MachOYAML.cpp index b98d4622a36..6724b24dd33 100644 --- a/llvm/lib/ObjectYAML/MachOYAML.cpp +++ b/llvm/lib/ObjectYAML/MachOYAML.cpp @@ -110,6 +110,10 @@ void MappingTraits<MachOYAML::LoadCommand>::mapping( switch (LoadCommand.Data.load_command_data.cmd) { #include "llvm/Support/MachO.def" } + if (LoadCommand.Data.load_command_data.cmd == MachO::LC_SEGMENT || + LoadCommand.Data.load_command_data.cmd == MachO::LC_SEGMENT_64) { + IO.mapOptional("Sections", LoadCommand.Sections); + } } void MappingTraits<MachO::dyld_info_command>::mapping( @@ -124,6 +128,22 @@ void MappingTraits<MachO::dyld_info_command>::mapping( IO.mapRequired("export_size", LoadCommand.export_size); } +void MappingTraits<MachOYAML::Section>::mapping(IO &IO, + MachOYAML::Section &Section) { + IO.mapRequired("sectname", Section.sectname); + IO.mapRequired("segname", Section.segname); + IO.mapRequired("addr", Section.addr); + IO.mapRequired("size", Section.size); + IO.mapRequired("offset", Section.offset); + IO.mapRequired("align", Section.align); + IO.mapRequired("reloff", Section.reloff); + IO.mapRequired("nreloc", Section.nreloc); + IO.mapRequired("flags", Section.flags); + IO.mapRequired("reserved1", Section.reserved1); + IO.mapRequired("reserved2", Section.reserved2); + IO.mapOptional("reserved3", Section.reserved3); +} + void MappingTraits<MachO::dylib>::mapping(IO &IO, MachO::dylib &DylibStruct) { IO.mapRequired("name", DylibStruct.name); IO.mapRequired("timestamp", DylibStruct.timestamp); |