1 //===- MachOYAML.cpp - MachO YAMLIO implementation ------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This file defines classes for handling the YAML representation of MachO.
11 //===----------------------------------------------------------------------===//
13 #include "llvm/ObjectYAML/MachOYAML.h"
14 #include "llvm/ADT/StringRef.h"
15 #include "llvm/BinaryFormat/MachO.h"
16 #include "llvm/Support/Format.h"
17 #include "llvm/Support/Host.h"
18 #include "llvm/Support/YAMLTraits.h"
19 #include "llvm/Support/raw_ostream.h"
26 MachOYAML::LoadCommand::~LoadCommand() = default;
28 bool MachOYAML::LinkEditData::isEmpty() const {
30 RebaseOpcodes.size() + BindOpcodes.size() + WeakBindOpcodes.size() +
31 LazyBindOpcodes.size() + ExportTrie.Children.size() +
32 NameList.size() + StringTable.size();
37 void ScalarTraits<char_16>::output(const char_16 &Val, void *,
39 auto Len = strnlen(&Val[0], 16);
40 Out << StringRef(&Val[0], Len);
43 StringRef ScalarTraits<char_16>::input(StringRef Scalar, void *, char_16 &Val) {
44 size_t CopySize = 16 >= Scalar.size() ? 16 : Scalar.size();
45 memcpy((void *)Val, Scalar.data(), CopySize);
47 if (Scalar.size() < 16) {
48 memset((void *)&Val[Scalar.size()], 0, 16 - Scalar.size());
54 QuotingType ScalarTraits<char_16>::mustQuote(StringRef S) {
55 return needsQuotes(S);
58 void ScalarTraits<uuid_t>::output(const uuid_t &Val, void *, raw_ostream &Out) {
62 StringRef ScalarTraits<uuid_t>::input(StringRef Scalar, void *, uuid_t &Val) {
64 for (size_t Idx = 0; Idx < Scalar.size(); ++Idx) {
65 if (Scalar[Idx] == '-' || OutIdx >= 16)
67 unsigned long long TempInt;
68 if (getAsUnsignedInteger(Scalar.slice(Idx, Idx + 2), 16, TempInt))
69 return "invalid number";
71 return "out of range number";
72 Val[OutIdx] = static_cast<uint8_t>(TempInt);
73 ++Idx; // increment idx an extra time because we're consuming 2 chars
79 QuotingType ScalarTraits<uuid_t>::mustQuote(StringRef S) {
80 return needsQuotes(S);
83 void MappingTraits<MachOYAML::FileHeader>::mapping(
84 IO &IO, MachOYAML::FileHeader &FileHdr) {
85 IO.mapRequired("magic", FileHdr.magic);
86 IO.mapRequired("cputype", FileHdr.cputype);
87 IO.mapRequired("cpusubtype", FileHdr.cpusubtype);
88 IO.mapRequired("filetype", FileHdr.filetype);
89 IO.mapRequired("ncmds", FileHdr.ncmds);
90 IO.mapRequired("sizeofcmds", FileHdr.sizeofcmds);
91 IO.mapRequired("flags", FileHdr.flags);
92 if (FileHdr.magic == MachO::MH_MAGIC_64 ||
93 FileHdr.magic == MachO::MH_CIGAM_64)
94 IO.mapRequired("reserved", FileHdr.reserved);
97 void MappingTraits<MachOYAML::Object>::mapping(IO &IO,
98 MachOYAML::Object &Object) {
99 // If the context isn't already set, tag the document as !mach-o.
100 // For Fat files there will be a different tag so they can be differentiated.
101 if (!IO.getContext()) {
102 IO.setContext(&Object);
104 IO.mapTag("!mach-o", true);
105 IO.mapOptional("IsLittleEndian", Object.IsLittleEndian,
106 sys::IsLittleEndianHost);
107 Object.DWARF.IsLittleEndian = Object.IsLittleEndian;
109 IO.mapRequired("FileHeader", Object.Header);
110 Object.DWARF.Is64BitAddrSize = Object.Header.magic == MachO::MH_MAGIC_64 ||
111 Object.Header.magic == MachO::MH_CIGAM_64;
112 IO.mapOptional("LoadCommands", Object.LoadCommands);
113 if(!Object.LinkEdit.isEmpty() || !IO.outputting())
114 IO.mapOptional("LinkEditData", Object.LinkEdit);
116 if(!Object.DWARF.isEmpty() || !IO.outputting())
117 IO.mapOptional("DWARF", Object.DWARF);
119 if (IO.getContext() == &Object)
120 IO.setContext(nullptr);
123 void MappingTraits<MachOYAML::FatHeader>::mapping(
124 IO &IO, MachOYAML::FatHeader &FatHeader) {
125 IO.mapRequired("magic", FatHeader.magic);
126 IO.mapRequired("nfat_arch", FatHeader.nfat_arch);
129 void MappingTraits<MachOYAML::FatArch>::mapping(IO &IO,
130 MachOYAML::FatArch &FatArch) {
131 IO.mapRequired("cputype", FatArch.cputype);
132 IO.mapRequired("cpusubtype", FatArch.cpusubtype);
133 IO.mapRequired("offset", FatArch.offset);
134 IO.mapRequired("size", FatArch.size);
135 IO.mapRequired("align", FatArch.align);
136 IO.mapOptional("reserved", FatArch.reserved,
137 static_cast<llvm::yaml::Hex32>(0));
140 void MappingTraits<MachOYAML::UniversalBinary>::mapping(
141 IO &IO, MachOYAML::UniversalBinary &UniversalBinary) {
142 if (!IO.getContext()) {
143 IO.setContext(&UniversalBinary);
144 IO.mapTag("!fat-mach-o", true);
146 IO.mapRequired("FatHeader", UniversalBinary.Header);
147 IO.mapRequired("FatArchs", UniversalBinary.FatArchs);
148 IO.mapRequired("Slices", UniversalBinary.Slices);
150 if (IO.getContext() == &UniversalBinary)
151 IO.setContext(nullptr);
154 void MappingTraits<MachOYAML::LinkEditData>::mapping(
155 IO &IO, MachOYAML::LinkEditData &LinkEditData) {
156 IO.mapOptional("RebaseOpcodes", LinkEditData.RebaseOpcodes);
157 IO.mapOptional("BindOpcodes", LinkEditData.BindOpcodes);
158 IO.mapOptional("WeakBindOpcodes", LinkEditData.WeakBindOpcodes);
159 IO.mapOptional("LazyBindOpcodes", LinkEditData.LazyBindOpcodes);
160 if (!LinkEditData.ExportTrie.Children.empty() || !IO.outputting())
161 IO.mapOptional("ExportTrie", LinkEditData.ExportTrie);
162 IO.mapOptional("NameList", LinkEditData.NameList);
163 IO.mapOptional("StringTable", LinkEditData.StringTable);
166 void MappingTraits<MachOYAML::RebaseOpcode>::mapping(
167 IO &IO, MachOYAML::RebaseOpcode &RebaseOpcode) {
168 IO.mapRequired("Opcode", RebaseOpcode.Opcode);
169 IO.mapRequired("Imm", RebaseOpcode.Imm);
170 IO.mapOptional("ExtraData", RebaseOpcode.ExtraData);
173 void MappingTraits<MachOYAML::BindOpcode>::mapping(
174 IO &IO, MachOYAML::BindOpcode &BindOpcode) {
175 IO.mapRequired("Opcode", BindOpcode.Opcode);
176 IO.mapRequired("Imm", BindOpcode.Imm);
177 IO.mapOptional("ULEBExtraData", BindOpcode.ULEBExtraData);
178 IO.mapOptional("SLEBExtraData", BindOpcode.SLEBExtraData);
179 IO.mapOptional("Symbol", BindOpcode.Symbol);
182 void MappingTraits<MachOYAML::ExportEntry>::mapping(
183 IO &IO, MachOYAML::ExportEntry &ExportEntry) {
184 IO.mapRequired("TerminalSize", ExportEntry.TerminalSize);
185 IO.mapOptional("NodeOffset", ExportEntry.NodeOffset);
186 IO.mapOptional("Name", ExportEntry.Name);
187 IO.mapOptional("Flags", ExportEntry.Flags);
188 IO.mapOptional("Address", ExportEntry.Address);
189 IO.mapOptional("Other", ExportEntry.Other);
190 IO.mapOptional("ImportName", ExportEntry.ImportName);
191 IO.mapOptional("Children", ExportEntry.Children);
194 void MappingTraits<MachOYAML::NListEntry>::mapping(
195 IO &IO, MachOYAML::NListEntry &NListEntry) {
196 IO.mapRequired("n_strx", NListEntry.n_strx);
197 IO.mapRequired("n_type", NListEntry.n_type);
198 IO.mapRequired("n_sect", NListEntry.n_sect);
199 IO.mapRequired("n_desc", NListEntry.n_desc);
200 IO.mapRequired("n_value", NListEntry.n_value);
203 template <typename StructType>
204 void mapLoadCommandData(IO &IO, MachOYAML::LoadCommand &LoadCommand) {}
207 void mapLoadCommandData<MachO::segment_command>(
208 IO &IO, MachOYAML::LoadCommand &LoadCommand) {
209 IO.mapOptional("Sections", LoadCommand.Sections);
213 void mapLoadCommandData<MachO::segment_command_64>(
214 IO &IO, MachOYAML::LoadCommand &LoadCommand) {
215 IO.mapOptional("Sections", LoadCommand.Sections);
219 void mapLoadCommandData<MachO::dylib_command>(
220 IO &IO, MachOYAML::LoadCommand &LoadCommand) {
221 IO.mapOptional("PayloadString", LoadCommand.PayloadString);
225 void mapLoadCommandData<MachO::rpath_command>(
226 IO &IO, MachOYAML::LoadCommand &LoadCommand) {
227 IO.mapOptional("PayloadString", LoadCommand.PayloadString);
231 void mapLoadCommandData<MachO::dylinker_command>(
232 IO &IO, MachOYAML::LoadCommand &LoadCommand) {
233 IO.mapOptional("PayloadString", LoadCommand.PayloadString);
237 void mapLoadCommandData<MachO::build_version_command>(
238 IO &IO, MachOYAML::LoadCommand &LoadCommand) {
239 IO.mapOptional("Tools", LoadCommand.Tools);
242 void MappingTraits<MachOYAML::LoadCommand>::mapping(
243 IO &IO, MachOYAML::LoadCommand &LoadCommand) {
244 MachO::LoadCommandType TempCmd = static_cast<MachO::LoadCommandType>(
245 LoadCommand.Data.load_command_data.cmd);
246 IO.mapRequired("cmd", TempCmd);
247 LoadCommand.Data.load_command_data.cmd = TempCmd;
248 IO.mapRequired("cmdsize", LoadCommand.Data.load_command_data.cmdsize);
250 #define HANDLE_LOAD_COMMAND(LCName, LCValue, LCStruct) \
251 case MachO::LCName: \
252 MappingTraits<MachO::LCStruct>::mapping(IO, \
253 LoadCommand.Data.LCStruct##_data); \
254 mapLoadCommandData<MachO::LCStruct>(IO, LoadCommand); \
257 switch (LoadCommand.Data.load_command_data.cmd) {
258 #include "llvm/BinaryFormat/MachO.def"
260 IO.mapOptional("PayloadBytes", LoadCommand.PayloadBytes);
261 IO.mapOptional("ZeroPadBytes", LoadCommand.ZeroPadBytes, (uint64_t)0ull);
264 void MappingTraits<MachO::dyld_info_command>::mapping(
265 IO &IO, MachO::dyld_info_command &LoadCommand) {
266 IO.mapRequired("rebase_off", LoadCommand.rebase_off);
267 IO.mapRequired("rebase_size", LoadCommand.rebase_size);
268 IO.mapRequired("bind_off", LoadCommand.bind_off);
269 IO.mapRequired("bind_size", LoadCommand.bind_size);
270 IO.mapRequired("weak_bind_off", LoadCommand.weak_bind_off);
271 IO.mapRequired("weak_bind_size", LoadCommand.weak_bind_size);
272 IO.mapRequired("lazy_bind_off", LoadCommand.lazy_bind_off);
273 IO.mapRequired("lazy_bind_size", LoadCommand.lazy_bind_size);
274 IO.mapRequired("export_off", LoadCommand.export_off);
275 IO.mapRequired("export_size", LoadCommand.export_size);
278 void MappingTraits<MachOYAML::Relocation>::mapping(
279 IO &IO, MachOYAML::Relocation &Relocation) {
280 IO.mapRequired("address", Relocation.address);
281 IO.mapRequired("symbolnum", Relocation.symbolnum);
282 IO.mapRequired("pcrel", Relocation.is_pcrel);
283 IO.mapRequired("length", Relocation.length);
284 IO.mapRequired("extern", Relocation.is_extern);
285 IO.mapRequired("type", Relocation.type);
286 IO.mapRequired("scattered", Relocation.is_scattered);
287 IO.mapRequired("value", Relocation.value);
290 void MappingTraits<MachOYAML::Section>::mapping(IO &IO,
291 MachOYAML::Section &Section) {
292 IO.mapRequired("sectname", Section.sectname);
293 IO.mapRequired("segname", Section.segname);
294 IO.mapRequired("addr", Section.addr);
295 IO.mapRequired("size", Section.size);
296 IO.mapRequired("offset", Section.offset);
297 IO.mapRequired("align", Section.align);
298 IO.mapRequired("reloff", Section.reloff);
299 IO.mapRequired("nreloc", Section.nreloc);
300 IO.mapRequired("flags", Section.flags);
301 IO.mapRequired("reserved1", Section.reserved1);
302 IO.mapRequired("reserved2", Section.reserved2);
303 IO.mapOptional("reserved3", Section.reserved3);
304 IO.mapOptional("content", Section.content);
305 IO.mapOptional("relocations", Section.relocations);
309 MappingTraits<MachOYAML::Section>::validate(IO &IO,
310 MachOYAML::Section &Section) {
311 if (Section.content && Section.size < Section.content->binary_size())
312 return "Section size must be greater than or equal to the content size";
316 void MappingTraits<MachO::build_tool_version>::mapping(
317 IO &IO, MachO::build_tool_version &tool) {
318 IO.mapRequired("tool", tool.tool);
319 IO.mapRequired("version", tool.version);
322 void MappingTraits<MachO::dylib>::mapping(IO &IO, MachO::dylib &DylibStruct) {
323 IO.mapRequired("name", DylibStruct.name);
324 IO.mapRequired("timestamp", DylibStruct.timestamp);
325 IO.mapRequired("current_version", DylibStruct.current_version);
326 IO.mapRequired("compatibility_version", DylibStruct.compatibility_version);
329 void MappingTraits<MachO::dylib_command>::mapping(
330 IO &IO, MachO::dylib_command &LoadCommand) {
331 IO.mapRequired("dylib", LoadCommand.dylib);
334 void MappingTraits<MachO::dylinker_command>::mapping(
335 IO &IO, MachO::dylinker_command &LoadCommand) {
336 IO.mapRequired("name", LoadCommand.name);
339 void MappingTraits<MachO::dysymtab_command>::mapping(
340 IO &IO, MachO::dysymtab_command &LoadCommand) {
341 IO.mapRequired("ilocalsym", LoadCommand.ilocalsym);
342 IO.mapRequired("nlocalsym", LoadCommand.nlocalsym);
343 IO.mapRequired("iextdefsym", LoadCommand.iextdefsym);
344 IO.mapRequired("nextdefsym", LoadCommand.nextdefsym);
345 IO.mapRequired("iundefsym", LoadCommand.iundefsym);
346 IO.mapRequired("nundefsym", LoadCommand.nundefsym);
347 IO.mapRequired("tocoff", LoadCommand.tocoff);
348 IO.mapRequired("ntoc", LoadCommand.ntoc);
349 IO.mapRequired("modtaboff", LoadCommand.modtaboff);
350 IO.mapRequired("nmodtab", LoadCommand.nmodtab);
351 IO.mapRequired("extrefsymoff", LoadCommand.extrefsymoff);
352 IO.mapRequired("nextrefsyms", LoadCommand.nextrefsyms);
353 IO.mapRequired("indirectsymoff", LoadCommand.indirectsymoff);
354 IO.mapRequired("nindirectsyms", LoadCommand.nindirectsyms);
355 IO.mapRequired("extreloff", LoadCommand.extreloff);
356 IO.mapRequired("nextrel", LoadCommand.nextrel);
357 IO.mapRequired("locreloff", LoadCommand.locreloff);
358 IO.mapRequired("nlocrel", LoadCommand.nlocrel);
361 void MappingTraits<MachO::encryption_info_command>::mapping(
362 IO &IO, MachO::encryption_info_command &LoadCommand) {
363 IO.mapRequired("cryptoff", LoadCommand.cryptoff);
364 IO.mapRequired("cryptsize", LoadCommand.cryptsize);
365 IO.mapRequired("cryptid", LoadCommand.cryptid);
368 void MappingTraits<MachO::encryption_info_command_64>::mapping(
369 IO &IO, MachO::encryption_info_command_64 &LoadCommand) {
370 IO.mapRequired("cryptoff", LoadCommand.cryptoff);
371 IO.mapRequired("cryptsize", LoadCommand.cryptsize);
372 IO.mapRequired("cryptid", LoadCommand.cryptid);
373 IO.mapRequired("pad", LoadCommand.pad);
376 void MappingTraits<MachO::entry_point_command>::mapping(
377 IO &IO, MachO::entry_point_command &LoadCommand) {
378 IO.mapRequired("entryoff", LoadCommand.entryoff);
379 IO.mapRequired("stacksize", LoadCommand.stacksize);
382 void MappingTraits<MachO::fvmfile_command>::mapping(
383 IO &IO, MachO::fvmfile_command &LoadCommand) {
384 IO.mapRequired("name", LoadCommand.name);
385 IO.mapRequired("header_addr", LoadCommand.header_addr);
388 void MappingTraits<MachO::fvmlib>::mapping(IO &IO, MachO::fvmlib &FVMLib) {
389 IO.mapRequired("name", FVMLib.name);
390 IO.mapRequired("minor_version", FVMLib.minor_version);
391 IO.mapRequired("header_addr", FVMLib.header_addr);
394 void MappingTraits<MachO::fvmlib_command>::mapping(
395 IO &IO, MachO::fvmlib_command &LoadCommand) {
396 IO.mapRequired("fvmlib", LoadCommand.fvmlib);
399 void MappingTraits<MachO::ident_command>::mapping(
400 IO &IO, MachO::ident_command &LoadCommand) {}
402 void MappingTraits<MachO::linkedit_data_command>::mapping(
403 IO &IO, MachO::linkedit_data_command &LoadCommand) {
404 IO.mapRequired("dataoff", LoadCommand.dataoff);
405 IO.mapRequired("datasize", LoadCommand.datasize);
408 void MappingTraits<MachO::linker_option_command>::mapping(
409 IO &IO, MachO::linker_option_command &LoadCommand) {
410 IO.mapRequired("count", LoadCommand.count);
413 void MappingTraits<MachO::prebind_cksum_command>::mapping(
414 IO &IO, MachO::prebind_cksum_command &LoadCommand) {
415 IO.mapRequired("cksum", LoadCommand.cksum);
418 void MappingTraits<MachO::load_command>::mapping(
419 IO &IO, MachO::load_command &LoadCommand) {}
421 void MappingTraits<MachO::prebound_dylib_command>::mapping(
422 IO &IO, MachO::prebound_dylib_command &LoadCommand) {
423 IO.mapRequired("name", LoadCommand.name);
424 IO.mapRequired("nmodules", LoadCommand.nmodules);
425 IO.mapRequired("linked_modules", LoadCommand.linked_modules);
428 void MappingTraits<MachO::routines_command>::mapping(
429 IO &IO, MachO::routines_command &LoadCommand) {
430 IO.mapRequired("init_address", LoadCommand.init_address);
431 IO.mapRequired("init_module", LoadCommand.init_module);
432 IO.mapRequired("reserved1", LoadCommand.reserved1);
433 IO.mapRequired("reserved2", LoadCommand.reserved2);
434 IO.mapRequired("reserved3", LoadCommand.reserved3);
435 IO.mapRequired("reserved4", LoadCommand.reserved4);
436 IO.mapRequired("reserved5", LoadCommand.reserved5);
437 IO.mapRequired("reserved6", LoadCommand.reserved6);
440 void MappingTraits<MachO::routines_command_64>::mapping(
441 IO &IO, MachO::routines_command_64 &LoadCommand) {
442 IO.mapRequired("init_address", LoadCommand.init_address);
443 IO.mapRequired("init_module", LoadCommand.init_module);
444 IO.mapRequired("reserved1", LoadCommand.reserved1);
445 IO.mapRequired("reserved2", LoadCommand.reserved2);
446 IO.mapRequired("reserved3", LoadCommand.reserved3);
447 IO.mapRequired("reserved4", LoadCommand.reserved4);
448 IO.mapRequired("reserved5", LoadCommand.reserved5);
449 IO.mapRequired("reserved6", LoadCommand.reserved6);
452 void MappingTraits<MachO::rpath_command>::mapping(
453 IO &IO, MachO::rpath_command &LoadCommand) {
454 IO.mapRequired("path", LoadCommand.path);
457 void MappingTraits<MachO::section>::mapping(IO &IO, MachO::section &Section) {
458 IO.mapRequired("sectname", Section.sectname);
459 IO.mapRequired("segname", Section.segname);
460 IO.mapRequired("addr", Section.addr);
461 IO.mapRequired("size", Section.size);
462 IO.mapRequired("offset", Section.offset);
463 IO.mapRequired("align", Section.align);
464 IO.mapRequired("reloff", Section.reloff);
465 IO.mapRequired("nreloc", Section.nreloc);
466 IO.mapRequired("flags", Section.flags);
467 IO.mapRequired("reserved1", Section.reserved1);
468 IO.mapRequired("reserved2", Section.reserved2);
471 void MappingTraits<MachO::section_64>::mapping(IO &IO,
472 MachO::section_64 &Section) {
473 IO.mapRequired("sectname", Section.sectname);
474 IO.mapRequired("segname", Section.segname);
475 IO.mapRequired("addr", Section.addr);
476 IO.mapRequired("size", Section.size);
477 IO.mapRequired("offset", Section.offset);
478 IO.mapRequired("align", Section.align);
479 IO.mapRequired("reloff", Section.reloff);
480 IO.mapRequired("nreloc", Section.nreloc);
481 IO.mapRequired("flags", Section.flags);
482 IO.mapRequired("reserved1", Section.reserved1);
483 IO.mapRequired("reserved2", Section.reserved2);
484 IO.mapRequired("reserved3", Section.reserved3);
487 void MappingTraits<MachO::segment_command>::mapping(
488 IO &IO, MachO::segment_command &LoadCommand) {
489 IO.mapRequired("segname", LoadCommand.segname);
490 IO.mapRequired("vmaddr", LoadCommand.vmaddr);
491 IO.mapRequired("vmsize", LoadCommand.vmsize);
492 IO.mapRequired("fileoff", LoadCommand.fileoff);
493 IO.mapRequired("filesize", LoadCommand.filesize);
494 IO.mapRequired("maxprot", LoadCommand.maxprot);
495 IO.mapRequired("initprot", LoadCommand.initprot);
496 IO.mapRequired("nsects", LoadCommand.nsects);
497 IO.mapRequired("flags", LoadCommand.flags);
500 void MappingTraits<MachO::segment_command_64>::mapping(
501 IO &IO, MachO::segment_command_64 &LoadCommand) {
502 IO.mapRequired("segname", LoadCommand.segname);
503 IO.mapRequired("vmaddr", LoadCommand.vmaddr);
504 IO.mapRequired("vmsize", LoadCommand.vmsize);
505 IO.mapRequired("fileoff", LoadCommand.fileoff);
506 IO.mapRequired("filesize", LoadCommand.filesize);
507 IO.mapRequired("maxprot", LoadCommand.maxprot);
508 IO.mapRequired("initprot", LoadCommand.initprot);
509 IO.mapRequired("nsects", LoadCommand.nsects);
510 IO.mapRequired("flags", LoadCommand.flags);
513 void MappingTraits<MachO::source_version_command>::mapping(
514 IO &IO, MachO::source_version_command &LoadCommand) {
515 IO.mapRequired("version", LoadCommand.version);
518 void MappingTraits<MachO::sub_client_command>::mapping(
519 IO &IO, MachO::sub_client_command &LoadCommand) {
520 IO.mapRequired("client", LoadCommand.client);
523 void MappingTraits<MachO::sub_framework_command>::mapping(
524 IO &IO, MachO::sub_framework_command &LoadCommand) {
525 IO.mapRequired("umbrella", LoadCommand.umbrella);
528 void MappingTraits<MachO::sub_library_command>::mapping(
529 IO &IO, MachO::sub_library_command &LoadCommand) {
530 IO.mapRequired("sub_library", LoadCommand.sub_library);
533 void MappingTraits<MachO::sub_umbrella_command>::mapping(
534 IO &IO, MachO::sub_umbrella_command &LoadCommand) {
535 IO.mapRequired("sub_umbrella", LoadCommand.sub_umbrella);
538 void MappingTraits<MachO::symseg_command>::mapping(
539 IO &IO, MachO::symseg_command &LoadCommand) {
540 IO.mapRequired("offset", LoadCommand.offset);
541 IO.mapRequired("size", LoadCommand.size);
544 void MappingTraits<MachO::symtab_command>::mapping(
545 IO &IO, MachO::symtab_command &LoadCommand) {
546 IO.mapRequired("symoff", LoadCommand.symoff);
547 IO.mapRequired("nsyms", LoadCommand.nsyms);
548 IO.mapRequired("stroff", LoadCommand.stroff);
549 IO.mapRequired("strsize", LoadCommand.strsize);
552 void MappingTraits<MachO::thread_command>::mapping(
553 IO &IO, MachO::thread_command &LoadCommand) {}
555 void MappingTraits<MachO::twolevel_hints_command>::mapping(
556 IO &IO, MachO::twolevel_hints_command &LoadCommand) {
557 IO.mapRequired("offset", LoadCommand.offset);
558 IO.mapRequired("nhints", LoadCommand.nhints);
561 void MappingTraits<MachO::uuid_command>::mapping(
562 IO &IO, MachO::uuid_command &LoadCommand) {
563 IO.mapRequired("uuid", LoadCommand.uuid);
566 void MappingTraits<MachO::version_min_command>::mapping(
567 IO &IO, MachO::version_min_command &LoadCommand) {
568 IO.mapRequired("version", LoadCommand.version);
569 IO.mapRequired("sdk", LoadCommand.sdk);
572 void MappingTraits<MachO::note_command>::mapping(
573 IO &IO, MachO::note_command &LoadCommand) {
574 IO.mapRequired("data_owner", LoadCommand.data_owner);
575 IO.mapRequired("offset", LoadCommand.offset);
576 IO.mapRequired("size", LoadCommand.size);
579 void MappingTraits<MachO::build_version_command>::mapping(
580 IO &IO, MachO::build_version_command &LoadCommand) {
581 IO.mapRequired("platform", LoadCommand.platform);
582 IO.mapRequired("minos", LoadCommand.minos);
583 IO.mapRequired("sdk", LoadCommand.sdk);
584 IO.mapRequired("ntools", LoadCommand.ntools);
587 } // end namespace yaml
589 } // end namespace llvm