From 6852775414a1872fda81b0249905c12cebdebfde Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Tue, 31 May 2016 17:26:36 +0000 Subject: [obj2yaml][yaml2obj] Support for reading and dumping the MachO export trie The MachO export trie is a serially encoded trie keyed by symbol name. This code parses the trie and preserves the structure so that it can be dumped again. llvm-svn: 271300 --- llvm/lib/ObjectYAML/MachOYAML.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'llvm/lib/ObjectYAML/MachOYAML.cpp') diff --git a/llvm/lib/ObjectYAML/MachOYAML.cpp b/llvm/lib/ObjectYAML/MachOYAML.cpp index af58cac6a02..6fe137215cf 100644 --- a/llvm/lib/ObjectYAML/MachOYAML.cpp +++ b/llvm/lib/ObjectYAML/MachOYAML.cpp @@ -103,6 +103,7 @@ void MappingTraits::mapping( IO.mapOptional("BindOpcodes", LinkEditData.BindOpcodes); IO.mapOptional("WeakBindOpcodes", LinkEditData.WeakBindOpcodes); IO.mapOptional("LazyBindOpcodes", LinkEditData.LazyBindOpcodes); + IO.mapOptional("ExportTrie", LinkEditData.ExportTrie); } void MappingTraits::mapping( @@ -121,6 +122,18 @@ void MappingTraits::mapping( IO.mapOptional("Symbol", BindOpcode.Symbol); } +void MappingTraits::mapping( + IO &IO, MachOYAML::ExportEntry &ExportEntry) { + IO.mapRequired("TerminalSize", ExportEntry.TerminalSize); + IO.mapOptional("NodeOffset", ExportEntry.NodeOffset); + IO.mapOptional("Name", ExportEntry.Name); + IO.mapOptional("Flags", ExportEntry.Flags); + IO.mapOptional("Address", ExportEntry.Address); + IO.mapOptional("Other", ExportEntry.Other); + IO.mapOptional("ImportName", ExportEntry.ImportName); + IO.mapOptional("Children", ExportEntry.Children); +} + template void mapLoadCommandData(IO &IO, MachOYAML::LoadCommand &LoadCommand) {} @@ -142,6 +155,12 @@ void mapLoadCommandData( IO.mapOptional("PayloadString", LoadCommand.PayloadString); } +template <> +void mapLoadCommandData( + IO &IO, MachOYAML::LoadCommand &LoadCommand) { + IO.mapOptional("PayloadString", LoadCommand.PayloadString); +} + template <> void mapLoadCommandData( IO &IO, MachOYAML::LoadCommand &LoadCommand) { -- cgit v1.2.3