From 07bb3c84a2d1eff7f3577cce023dca517aa7c3ed Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Thu, 2 Jun 2016 22:54:06 +0000 Subject: [obj2yaml] [yaml2obj] Support for MachO nlist and string table This commit adds round tripping for MachO symbol data. Symbols are entries in the name list, that contain offsets into the string table which is at the end of the __LINKEDIT segment. llvm-svn: 271604 --- llvm/lib/ObjectYAML/MachOYAML.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'llvm/lib/ObjectYAML/MachOYAML.cpp') diff --git a/llvm/lib/ObjectYAML/MachOYAML.cpp b/llvm/lib/ObjectYAML/MachOYAML.cpp index 6fe137215cf..b4e808552df 100644 --- a/llvm/lib/ObjectYAML/MachOYAML.cpp +++ b/llvm/lib/ObjectYAML/MachOYAML.cpp @@ -104,6 +104,8 @@ void MappingTraits::mapping( IO.mapOptional("WeakBindOpcodes", LinkEditData.WeakBindOpcodes); IO.mapOptional("LazyBindOpcodes", LinkEditData.LazyBindOpcodes); IO.mapOptional("ExportTrie", LinkEditData.ExportTrie); + IO.mapOptional("NameList", LinkEditData.NameList); + IO.mapOptional("StringTable", LinkEditData.StringTable); } void MappingTraits::mapping( @@ -134,6 +136,15 @@ void MappingTraits::mapping( IO.mapOptional("Children", ExportEntry.Children); } +void MappingTraits::mapping( + IO &IO, MachOYAML::NListEntry &NListEntry) { + IO.mapRequired("n_strx", NListEntry.n_strx); + IO.mapRequired("n_type", NListEntry.n_type); + IO.mapRequired("n_sect", NListEntry.n_sect); + IO.mapRequired("n_desc", NListEntry.n_desc); + IO.mapRequired("n_value", NListEntry.n_value); +} + template void mapLoadCommandData(IO &IO, MachOYAML::LoadCommand &LoadCommand) {} -- cgit v1.2.3