[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
diff --git a/llvm/lib/ObjectYAML/MachOYAML.cpp b/llvm/lib/ObjectYAML/MachOYAML.cpp
index 6fe1372..b4e8085 100644
--- a/llvm/lib/ObjectYAML/MachOYAML.cpp
+++ b/llvm/lib/ObjectYAML/MachOYAML.cpp
@@ -104,6 +104,8 @@
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<MachOYAML::RebaseOpcode>::mapping(
@@ -134,6 +136,15 @@
IO.mapOptional("Children", ExportEntry.Children);
}
+void MappingTraits<MachOYAML::NListEntry>::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 <typename StructType>
void mapLoadCommandData(IO &IO, MachOYAML::LoadCommand &LoadCommand) {}