diff options
author | Chris Bieneman <beanz@apple.com> | 2016-05-18 16:17:23 +0000 |
---|---|---|
committer | Chris Bieneman <beanz@apple.com> | 2016-05-18 16:17:23 +0000 |
commit | 7ec0ea16b76a61c5f773fa3abd96335647190229 (patch) | |
tree | ee1a5398f1bd01780839719ab5cdce82cf2210c6 /include | |
parent | 76e32dfbc0acecb33e2141a0c2faf5b23e1342fc (diff) |
Re-apply: [obj2yaml] [yaml2obj] Support MachO section and section_64
This re-applies r269845, r269846, and r269850 with an included fix for a crash reported by zturner.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269953 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/ObjectYAML/MachOYAML.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/include/llvm/ObjectYAML/MachOYAML.h b/include/llvm/ObjectYAML/MachOYAML.h index 21558f00cc0..3c79a20c55a 100644 --- a/include/llvm/ObjectYAML/MachOYAML.h +++ b/include/llvm/ObjectYAML/MachOYAML.h @@ -22,6 +22,21 @@ namespace llvm { namespace MachOYAML { +struct Section { + char sectname[16]; + char segname[16]; + llvm::yaml::Hex64 addr; + uint64_t size; + llvm::yaml::Hex32 offset; + uint32_t align; + llvm::yaml::Hex32 reloff; + uint32_t nreloc; + llvm::yaml::Hex32 flags; + llvm::yaml::Hex32 reserved1; + llvm::yaml::Hex32 reserved2; + llvm::yaml::Hex32 reserved3; +}; + struct FileHeader { llvm::yaml::Hex32 magic; llvm::yaml::Hex32 cputype; @@ -36,17 +51,20 @@ struct FileHeader { struct LoadCommand { virtual ~LoadCommand(); llvm::MachO::macho_load_command Data; + std::vector<Section> Sections; }; struct Object { FileHeader Header; std::vector<LoadCommand> LoadCommands; + std::vector<Section> Sections; }; } // namespace llvm::MachOYAML } // namespace llvm LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::MachOYAML::LoadCommand) +LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::MachOYAML::Section) namespace llvm { namespace yaml { @@ -63,6 +81,10 @@ template <> struct MappingTraits<MachOYAML::LoadCommand> { static void mapping(IO &IO, MachOYAML::LoadCommand &LoadCommand); }; +template <> struct MappingTraits<MachOYAML::Section> { + static void mapping(IO &IO, MachOYAML::Section &Section); +}; + #define HANDLE_LOAD_COMMAND(LCName, LCValue, LCStruct) \ io.enumCase(value, #LCName, MachO::LCName); |