LLVM  6.0.0svn
MachOYAML.cpp
Go to the documentation of this file.
1 //===- MachOYAML.cpp - MachO YAMLIO implementation ------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines classes for handling the YAML representation of MachO.
11 //
12 //===----------------------------------------------------------------------===//
13 
15 #include "llvm/ADT/StringRef.h"
17 #include "llvm/Support/Format.h"
18 #include "llvm/Support/Host.h"
21 #include <cinttypes>
22 #include <cstdint>
23 #include <cstring>
24 
25 namespace llvm {
26 
28 
30  return 0 ==
31  RebaseOpcodes.size() + BindOpcodes.size() + WeakBindOpcodes.size() +
32  LazyBindOpcodes.size() + ExportTrie.Children.size() +
33  NameList.size() + StringTable.size();
34 }
35 
36 namespace yaml {
37 
38 void ScalarTraits<char_16>::output(const char_16 &Val, void *,
39  raw_ostream &Out) {
40  auto Len = strnlen(&Val[0], 16);
41  Out << StringRef(&Val[0], Len);
42 }
43 
45  size_t CopySize = 16 >= Scalar.size() ? 16 : Scalar.size();
46  memcpy((void *)Val, Scalar.data(), CopySize);
47 
48  if (Scalar.size() < 16) {
49  memset((void *)&Val[Scalar.size()], 0, 16 - Scalar.size());
50  }
51 
52  return StringRef();
53 }
54 
56 
57 void ScalarTraits<uuid_t>::output(const uuid_t &Val, void *, raw_ostream &Out) {
58  Out.write_uuid(Val);
59 }
60 
62  size_t OutIdx = 0;
63  for (size_t Idx = 0; Idx < Scalar.size(); ++Idx) {
64  if (Scalar[Idx] == '-' || OutIdx >= 16)
65  continue;
66  unsigned long long TempInt;
67  if (getAsUnsignedInteger(Scalar.slice(Idx, Idx + 2), 16, TempInt))
68  return "invalid number";
69  if (TempInt > 0xFF)
70  return "out of range number";
71  Val[OutIdx] = static_cast<uint8_t>(TempInt);
72  ++Idx; // increment idx an extra time because we're consuming 2 chars
73  ++OutIdx;
74  }
75  return StringRef();
76 }
77 
79 
81  IO &IO, MachOYAML::FileHeader &FileHdr) {
82  IO.mapRequired("magic", FileHdr.magic);
83  IO.mapRequired("cputype", FileHdr.cputype);
84  IO.mapRequired("cpusubtype", FileHdr.cpusubtype);
85  IO.mapRequired("filetype", FileHdr.filetype);
86  IO.mapRequired("ncmds", FileHdr.ncmds);
87  IO.mapRequired("sizeofcmds", FileHdr.sizeofcmds);
88  IO.mapRequired("flags", FileHdr.flags);
89  if (FileHdr.magic == MachO::MH_MAGIC_64 ||
90  FileHdr.magic == MachO::MH_CIGAM_64)
91  IO.mapRequired("reserved", FileHdr.reserved);
92 }
93 
95  MachOYAML::Object &Object) {
96  // If the context isn't already set, tag the document as !mach-o.
97  // For Fat files there will be a different tag so they can be differentiated.
98  if (!IO.getContext()) {
99  IO.setContext(&Object);
100  }
101  IO.mapTag("!mach-o", true);
102  IO.mapOptional("IsLittleEndian", Object.IsLittleEndian,
104  Object.DWARF.IsLittleEndian = Object.IsLittleEndian;
105 
106  IO.mapRequired("FileHeader", Object.Header);
107  IO.mapOptional("LoadCommands", Object.LoadCommands);
108  if(!Object.LinkEdit.isEmpty() || !IO.outputting())
109  IO.mapOptional("LinkEditData", Object.LinkEdit);
110 
111  if(!Object.DWARF.isEmpty() || !IO.outputting())
112  IO.mapOptional("DWARF", Object.DWARF);
113 
114  if (IO.getContext() == &Object)
115  IO.setContext(nullptr);
116 }
117 
119  IO &IO, MachOYAML::FatHeader &FatHeader) {
120  IO.mapRequired("magic", FatHeader.magic);
121  IO.mapRequired("nfat_arch", FatHeader.nfat_arch);
122 }
123 
125  MachOYAML::FatArch &FatArch) {
126  IO.mapRequired("cputype", FatArch.cputype);
127  IO.mapRequired("cpusubtype", FatArch.cpusubtype);
128  IO.mapRequired("offset", FatArch.offset);
129  IO.mapRequired("size", FatArch.size);
130  IO.mapRequired("align", FatArch.align);
131  IO.mapOptional("reserved", FatArch.reserved,
132  static_cast<llvm::yaml::Hex32>(0));
133 }
134 
136  IO &IO, MachOYAML::UniversalBinary &UniversalBinary) {
137  if (!IO.getContext()) {
138  IO.setContext(&UniversalBinary);
139  IO.mapTag("!fat-mach-o", true);
140  }
141  IO.mapRequired("FatHeader", UniversalBinary.Header);
142  IO.mapRequired("FatArchs", UniversalBinary.FatArchs);
143  IO.mapRequired("Slices", UniversalBinary.Slices);
144 
145  if (IO.getContext() == &UniversalBinary)
146  IO.setContext(nullptr);
147 }
148 
150  IO &IO, MachOYAML::LinkEditData &LinkEditData) {
151  IO.mapOptional("RebaseOpcodes", LinkEditData.RebaseOpcodes);
152  IO.mapOptional("BindOpcodes", LinkEditData.BindOpcodes);
153  IO.mapOptional("WeakBindOpcodes", LinkEditData.WeakBindOpcodes);
154  IO.mapOptional("LazyBindOpcodes", LinkEditData.LazyBindOpcodes);
155  if (!LinkEditData.ExportTrie.Children.empty() || !IO.outputting())
156  IO.mapOptional("ExportTrie", LinkEditData.ExportTrie);
157  IO.mapOptional("NameList", LinkEditData.NameList);
158  IO.mapOptional("StringTable", LinkEditData.StringTable);
159 }
160 
163  IO.mapRequired("Opcode", RebaseOpcode.Opcode);
164  IO.mapRequired("Imm", RebaseOpcode.Imm);
165  IO.mapOptional("ExtraData", RebaseOpcode.ExtraData);
166 }
167 
170  IO.mapRequired("Opcode", BindOpcode.Opcode);
171  IO.mapRequired("Imm", BindOpcode.Imm);
172  IO.mapOptional("ULEBExtraData", BindOpcode.ULEBExtraData);
173  IO.mapOptional("SLEBExtraData", BindOpcode.SLEBExtraData);
174  IO.mapOptional("Symbol", BindOpcode.Symbol);
175 }
176 
178  IO &IO, MachOYAML::ExportEntry &ExportEntry) {
179  IO.mapRequired("TerminalSize", ExportEntry.TerminalSize);
180  IO.mapOptional("NodeOffset", ExportEntry.NodeOffset);
181  IO.mapOptional("Name", ExportEntry.Name);
182  IO.mapOptional("Flags", ExportEntry.Flags);
183  IO.mapOptional("Address", ExportEntry.Address);
184  IO.mapOptional("Other", ExportEntry.Other);
185  IO.mapOptional("ImportName", ExportEntry.ImportName);
186  IO.mapOptional("Children", ExportEntry.Children);
187 }
188 
190  IO &IO, MachOYAML::NListEntry &NListEntry) {
191  IO.mapRequired("n_strx", NListEntry.n_strx);
192  IO.mapRequired("n_type", NListEntry.n_type);
193  IO.mapRequired("n_sect", NListEntry.n_sect);
194  IO.mapRequired("n_desc", NListEntry.n_desc);
195  IO.mapRequired("n_value", NListEntry.n_value);
196 }
197 
198 template <typename StructType>
200 
201 template <>
202 void mapLoadCommandData<MachO::segment_command>(
203  IO &IO, MachOYAML::LoadCommand &LoadCommand) {
204  IO.mapOptional("Sections", LoadCommand.Sections);
205 }
206 
207 template <>
208 void mapLoadCommandData<MachO::segment_command_64>(
209  IO &IO, MachOYAML::LoadCommand &LoadCommand) {
210  IO.mapOptional("Sections", LoadCommand.Sections);
211 }
212 
213 template <>
214 void mapLoadCommandData<MachO::dylib_command>(
215  IO &IO, MachOYAML::LoadCommand &LoadCommand) {
216  IO.mapOptional("PayloadString", LoadCommand.PayloadString);
217 }
218 
219 template <>
220 void mapLoadCommandData<MachO::rpath_command>(
221  IO &IO, MachOYAML::LoadCommand &LoadCommand) {
222  IO.mapOptional("PayloadString", LoadCommand.PayloadString);
223 }
224 
225 template <>
226 void mapLoadCommandData<MachO::dylinker_command>(
227  IO &IO, MachOYAML::LoadCommand &LoadCommand) {
228  IO.mapOptional("PayloadString", LoadCommand.PayloadString);
229 }
230 
231 template <>
232 void mapLoadCommandData<MachO::build_version_command>(
233  IO &IO, MachOYAML::LoadCommand &LoadCommand) {
234  IO.mapOptional("Tools", LoadCommand.Tools);
235 }
236 
238  IO &IO, MachOYAML::LoadCommand &LoadCommand) {
239  MachO::LoadCommandType TempCmd = static_cast<MachO::LoadCommandType>(
240  LoadCommand.Data.load_command_data.cmd);
241  IO.mapRequired("cmd", TempCmd);
242  LoadCommand.Data.load_command_data.cmd = TempCmd;
243  IO.mapRequired("cmdsize", LoadCommand.Data.load_command_data.cmdsize);
244 
245 #define HANDLE_LOAD_COMMAND(LCName, LCValue, LCStruct) \
246  case MachO::LCName: \
247  MappingTraits<MachO::LCStruct>::mapping(IO, \
248  LoadCommand.Data.LCStruct##_data); \
249  mapLoadCommandData<MachO::LCStruct>(IO, LoadCommand); \
250  break;
251 
252  switch (LoadCommand.Data.load_command_data.cmd) {
253 #include "llvm/BinaryFormat/MachO.def"
254  }
255  IO.mapOptional("PayloadBytes", LoadCommand.PayloadBytes);
256  IO.mapOptional("ZeroPadBytes", LoadCommand.ZeroPadBytes, (uint64_t)0ull);
257 }
258 
260  IO &IO, MachO::dyld_info_command &LoadCommand) {
261  IO.mapRequired("rebase_off", LoadCommand.rebase_off);
262  IO.mapRequired("rebase_size", LoadCommand.rebase_size);
263  IO.mapRequired("bind_off", LoadCommand.bind_off);
264  IO.mapRequired("bind_size", LoadCommand.bind_size);
265  IO.mapRequired("weak_bind_off", LoadCommand.weak_bind_off);
266  IO.mapRequired("weak_bind_size", LoadCommand.weak_bind_size);
267  IO.mapRequired("lazy_bind_off", LoadCommand.lazy_bind_off);
268  IO.mapRequired("lazy_bind_size", LoadCommand.lazy_bind_size);
269  IO.mapRequired("export_off", LoadCommand.export_off);
270  IO.mapRequired("export_size", LoadCommand.export_size);
271 }
272 
275  IO.mapRequired("sectname", Section.sectname);
276  IO.mapRequired("segname", Section.segname);
277  IO.mapRequired("addr", Section.addr);
278  IO.mapRequired("size", Section.size);
279  IO.mapRequired("offset", Section.offset);
280  IO.mapRequired("align", Section.align);
281  IO.mapRequired("reloff", Section.reloff);
282  IO.mapRequired("nreloc", Section.nreloc);
283  IO.mapRequired("flags", Section.flags);
284  IO.mapRequired("reserved1", Section.reserved1);
285  IO.mapRequired("reserved2", Section.reserved2);
286  IO.mapOptional("reserved3", Section.reserved3);
287 }
288 
290  IO &IO, MachO::build_tool_version &tool) {
291  IO.mapRequired("tool", tool.tool);
292  IO.mapRequired("version", tool.version);
293 }
294 
296  IO.mapRequired("name", DylibStruct.name);
297  IO.mapRequired("timestamp", DylibStruct.timestamp);
298  IO.mapRequired("current_version", DylibStruct.current_version);
299  IO.mapRequired("compatibility_version", DylibStruct.compatibility_version);
300 }
301 
303  IO &IO, MachO::dylib_command &LoadCommand) {
304  IO.mapRequired("dylib", LoadCommand.dylib);
305 }
306 
308  IO &IO, MachO::dylinker_command &LoadCommand) {
309  IO.mapRequired("name", LoadCommand.name);
310 }
311 
313  IO &IO, MachO::dysymtab_command &LoadCommand) {
314  IO.mapRequired("ilocalsym", LoadCommand.ilocalsym);
315  IO.mapRequired("nlocalsym", LoadCommand.nlocalsym);
316  IO.mapRequired("iextdefsym", LoadCommand.iextdefsym);
317  IO.mapRequired("nextdefsym", LoadCommand.nextdefsym);
318  IO.mapRequired("iundefsym", LoadCommand.iundefsym);
319  IO.mapRequired("nundefsym", LoadCommand.nundefsym);
320  IO.mapRequired("tocoff", LoadCommand.tocoff);
321  IO.mapRequired("ntoc", LoadCommand.ntoc);
322  IO.mapRequired("modtaboff", LoadCommand.modtaboff);
323  IO.mapRequired("nmodtab", LoadCommand.nmodtab);
324  IO.mapRequired("extrefsymoff", LoadCommand.extrefsymoff);
325  IO.mapRequired("nextrefsyms", LoadCommand.nextrefsyms);
326  IO.mapRequired("indirectsymoff", LoadCommand.indirectsymoff);
327  IO.mapRequired("nindirectsyms", LoadCommand.nindirectsyms);
328  IO.mapRequired("extreloff", LoadCommand.extreloff);
329  IO.mapRequired("nextrel", LoadCommand.nextrel);
330  IO.mapRequired("locreloff", LoadCommand.locreloff);
331  IO.mapRequired("nlocrel", LoadCommand.nlocrel);
332 }
333 
335  IO &IO, MachO::encryption_info_command &LoadCommand) {
336  IO.mapRequired("cryptoff", LoadCommand.cryptoff);
337  IO.mapRequired("cryptsize", LoadCommand.cryptsize);
338  IO.mapRequired("cryptid", LoadCommand.cryptid);
339 }
340 
342  IO &IO, MachO::encryption_info_command_64 &LoadCommand) {
343  IO.mapRequired("cryptoff", LoadCommand.cryptoff);
344  IO.mapRequired("cryptsize", LoadCommand.cryptsize);
345  IO.mapRequired("cryptid", LoadCommand.cryptid);
346  IO.mapRequired("pad", LoadCommand.pad);
347 }
348 
350  IO &IO, MachO::entry_point_command &LoadCommand) {
351  IO.mapRequired("entryoff", LoadCommand.entryoff);
352  IO.mapRequired("stacksize", LoadCommand.stacksize);
353 }
354 
356  IO &IO, MachO::fvmfile_command &LoadCommand) {
357  IO.mapRequired("name", LoadCommand.name);
358  IO.mapRequired("header_addr", LoadCommand.header_addr);
359 }
360 
362  IO.mapRequired("name", FVMLib.name);
363  IO.mapRequired("minor_version", FVMLib.minor_version);
364  IO.mapRequired("header_addr", FVMLib.header_addr);
365 }
366 
368  IO &IO, MachO::fvmlib_command &LoadCommand) {
369  IO.mapRequired("fvmlib", LoadCommand.fvmlib);
370 }
371 
373  IO &IO, MachO::ident_command &LoadCommand) {}
374 
376  IO &IO, MachO::linkedit_data_command &LoadCommand) {
377  IO.mapRequired("dataoff", LoadCommand.dataoff);
378  IO.mapRequired("datasize", LoadCommand.datasize);
379 }
380 
382  IO &IO, MachO::linker_option_command &LoadCommand) {
383  IO.mapRequired("count", LoadCommand.count);
384 }
385 
387  IO &IO, MachO::prebind_cksum_command &LoadCommand) {
388  IO.mapRequired("cksum", LoadCommand.cksum);
389 }
390 
392  IO &IO, MachO::load_command &LoadCommand) {}
393 
395  IO &IO, MachO::prebound_dylib_command &LoadCommand) {
396  IO.mapRequired("name", LoadCommand.name);
397  IO.mapRequired("nmodules", LoadCommand.nmodules);
398  IO.mapRequired("linked_modules", LoadCommand.linked_modules);
399 }
400 
402  IO &IO, MachO::routines_command &LoadCommand) {
403  IO.mapRequired("init_address", LoadCommand.init_address);
404  IO.mapRequired("init_module", LoadCommand.init_module);
405  IO.mapRequired("reserved1", LoadCommand.reserved1);
406  IO.mapRequired("reserved2", LoadCommand.reserved2);
407  IO.mapRequired("reserved3", LoadCommand.reserved3);
408  IO.mapRequired("reserved4", LoadCommand.reserved4);
409  IO.mapRequired("reserved5", LoadCommand.reserved5);
410  IO.mapRequired("reserved6", LoadCommand.reserved6);
411 }
412 
414  IO &IO, MachO::routines_command_64 &LoadCommand) {
415  IO.mapRequired("init_address", LoadCommand.init_address);
416  IO.mapRequired("init_module", LoadCommand.init_module);
417  IO.mapRequired("reserved1", LoadCommand.reserved1);
418  IO.mapRequired("reserved2", LoadCommand.reserved2);
419  IO.mapRequired("reserved3", LoadCommand.reserved3);
420  IO.mapRequired("reserved4", LoadCommand.reserved4);
421  IO.mapRequired("reserved5", LoadCommand.reserved5);
422  IO.mapRequired("reserved6", LoadCommand.reserved6);
423 }
424 
426  IO &IO, MachO::rpath_command &LoadCommand) {
427  IO.mapRequired("path", LoadCommand.path);
428 }
429 
431  IO.mapRequired("sectname", Section.sectname);
432  IO.mapRequired("segname", Section.segname);
433  IO.mapRequired("addr", Section.addr);
434  IO.mapRequired("size", Section.size);
435  IO.mapRequired("offset", Section.offset);
436  IO.mapRequired("align", Section.align);
437  IO.mapRequired("reloff", Section.reloff);
438  IO.mapRequired("nreloc", Section.nreloc);
439  IO.mapRequired("flags", Section.flags);
440  IO.mapRequired("reserved1", Section.reserved1);
441  IO.mapRequired("reserved2", Section.reserved2);
442 }
443 
446  IO.mapRequired("sectname", Section.sectname);
447  IO.mapRequired("segname", Section.segname);
448  IO.mapRequired("addr", Section.addr);
449  IO.mapRequired("size", Section.size);
450  IO.mapRequired("offset", Section.offset);
451  IO.mapRequired("align", Section.align);
452  IO.mapRequired("reloff", Section.reloff);
453  IO.mapRequired("nreloc", Section.nreloc);
454  IO.mapRequired("flags", Section.flags);
455  IO.mapRequired("reserved1", Section.reserved1);
456  IO.mapRequired("reserved2", Section.reserved2);
457  IO.mapRequired("reserved3", Section.reserved3);
458 }
459 
461  IO &IO, MachO::segment_command &LoadCommand) {
462  IO.mapRequired("segname", LoadCommand.segname);
463  IO.mapRequired("vmaddr", LoadCommand.vmaddr);
464  IO.mapRequired("vmsize", LoadCommand.vmsize);
465  IO.mapRequired("fileoff", LoadCommand.fileoff);
466  IO.mapRequired("filesize", LoadCommand.filesize);
467  IO.mapRequired("maxprot", LoadCommand.maxprot);
468  IO.mapRequired("initprot", LoadCommand.initprot);
469  IO.mapRequired("nsects", LoadCommand.nsects);
470  IO.mapRequired("flags", LoadCommand.flags);
471 }
472 
474  IO &IO, MachO::segment_command_64 &LoadCommand) {
475  IO.mapRequired("segname", LoadCommand.segname);
476  IO.mapRequired("vmaddr", LoadCommand.vmaddr);
477  IO.mapRequired("vmsize", LoadCommand.vmsize);
478  IO.mapRequired("fileoff", LoadCommand.fileoff);
479  IO.mapRequired("filesize", LoadCommand.filesize);
480  IO.mapRequired("maxprot", LoadCommand.maxprot);
481  IO.mapRequired("initprot", LoadCommand.initprot);
482  IO.mapRequired("nsects", LoadCommand.nsects);
483  IO.mapRequired("flags", LoadCommand.flags);
484 }
485 
487  IO &IO, MachO::source_version_command &LoadCommand) {
488  IO.mapRequired("version", LoadCommand.version);
489 }
490 
492  IO &IO, MachO::sub_client_command &LoadCommand) {
493  IO.mapRequired("client", LoadCommand.client);
494 }
495 
497  IO &IO, MachO::sub_framework_command &LoadCommand) {
498  IO.mapRequired("umbrella", LoadCommand.umbrella);
499 }
500 
502  IO &IO, MachO::sub_library_command &LoadCommand) {
503  IO.mapRequired("sub_library", LoadCommand.sub_library);
504 }
505 
507  IO &IO, MachO::sub_umbrella_command &LoadCommand) {
508  IO.mapRequired("sub_umbrella", LoadCommand.sub_umbrella);
509 }
510 
512  IO &IO, MachO::symseg_command &LoadCommand) {
513  IO.mapRequired("offset", LoadCommand.offset);
514  IO.mapRequired("size", LoadCommand.size);
515 }
516 
518  IO &IO, MachO::symtab_command &LoadCommand) {
519  IO.mapRequired("symoff", LoadCommand.symoff);
520  IO.mapRequired("nsyms", LoadCommand.nsyms);
521  IO.mapRequired("stroff", LoadCommand.stroff);
522  IO.mapRequired("strsize", LoadCommand.strsize);
523 }
524 
526  IO &IO, MachO::thread_command &LoadCommand) {}
527 
529  IO &IO, MachO::twolevel_hints_command &LoadCommand) {
530  IO.mapRequired("offset", LoadCommand.offset);
531  IO.mapRequired("nhints", LoadCommand.nhints);
532 }
533 
535  IO &IO, MachO::uuid_command &LoadCommand) {
536  IO.mapRequired("uuid", LoadCommand.uuid);
537 }
538 
540  IO &IO, MachO::version_min_command &LoadCommand) {
541  IO.mapRequired("version", LoadCommand.version);
542  IO.mapRequired("sdk", LoadCommand.sdk);
543 }
544 
546  IO &IO, MachO::note_command &LoadCommand) {
547  IO.mapRequired("data_owner", LoadCommand.data_owner);
548  IO.mapRequired("offset", LoadCommand.offset);
549  IO.mapRequired("size", LoadCommand.size);
550 }
551 
553  IO &IO, MachO::build_version_command &LoadCommand) {
554  IO.mapRequired("platform", LoadCommand.platform);
555  IO.mapRequired("minos", LoadCommand.minos);
556  IO.mapRequired("sdk", LoadCommand.sdk);
557  IO.mapRequired("ntools", LoadCommand.ntools);
558 }
559 
560 } // end namespace yaml
561 
562 } // end namespace llvm
LoadCommandType
Definition: MachO.h:92
uint32_t header_addr
Definition: MachO.h:583
struct dylib dylib
Definition: MachO.h:603
void mapOptional(const char *Key, T &Val)
Definition: YAMLTraits.h:656
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
llvm::yaml::Hex64 addr
Definition: MachOYAML.h:33
std::vector< Object > Slices
Definition: MachOYAML.h:138
std::vector< MachOYAML::ExportEntry > Children
Definition: MachOYAML.h:97
std::vector< llvm::yaml::Hex8 > PayloadBytes
Definition: MachOYAML.h:62
bool isEmpty() const
Definition: DWARFYAML.cpp:19
llvm::yaml::Hex32 magic
Definition: MachOYAML.h:122
bool getAsUnsignedInteger(StringRef Str, unsigned Radix, unsigned long long &Result)
Helper functions for StringRef::getAsInteger.
Definition: StringRef.cpp:504
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
Definition: StringRef.h:138
uint32_t reserved1
Definition: MachO.h:561
llvm::yaml::Hex64 offset
Definition: MachOYAML.h:129
void * getContext()
Definition: YAMLTraits.cpp:43
std::vector< int64_t > SLEBExtraData
Definition: MachOYAML.h:85
char[16] char_16
Definition: MachOYAML.h:259
bool needsQuotes(StringRef S)
Definition: YAMLTraits.h:498
uint32_t reserved2
Definition: MachO.h:576
uint32_t size
Definition: MachO.h:555
DWARFYAML::Data DWARF
Definition: MachOYAML.h:118
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
Definition: StringRef.h:128
llvm::yaml::Hex32 cputype
Definition: MachOYAML.h:47
raw_ostream & write_uuid(const uuid_t UUID)
uint32_t name
Definition: MachO.h:594
uint32_t reloff
Definition: MachO.h:558
llvm::yaml::Hex32 flags
Definition: MachOYAML.h:52
std::vector< MachOYAML::RebaseOpcode > RebaseOpcodes
Definition: MachOYAML.h:101
llvm::yaml::Hex32 cputype
Definition: MachOYAML.h:127
static const bool IsLittleEndianHost
Definition: Host.h:50
llvm::yaml::Hex32 cpusubtype
Definition: MachOYAML.h:128
This class should be specialized by any type that needs to be converted to/from a YAML mapping...
std::vector< yaml::Hex64 > ExtraData
Definition: MachOYAML.h:78
LinkEditData LinkEdit
Definition: MachOYAML.h:117
std::vector< LoadCommand > LoadCommands
Definition: MachOYAML.h:115
virtual bool mapTag(StringRef Tag, bool Default=false)=0
uint32_t flags
Definition: MachO.h:560
llvm::yaml::Hex64 Address
Definition: MachOYAML.h:94
llvm::yaml::Hex64 Flags
Definition: MachOYAML.h:93
std::vector< MachOYAML::BindOpcode > WeakBindOpcodes
Definition: MachOYAML.h:103
uint32_t reserved1
Definition: MachO.h:575
MachOYAML::ExportEntry ExportTrie
Definition: MachOYAML.h:105
llvm::yaml::Hex32 offset
Definition: MachOYAML.h:35
std::vector< yaml::Hex64 > ULEBExtraData
Definition: MachOYAML.h:84
RebaseOpcode
Definition: MachO.h:232
MachO::RebaseOpcode Opcode
Definition: MachOYAML.h:76
std::vector< MachOYAML::BindOpcode > BindOpcodes
Definition: MachOYAML.h:102
uint8_t uuid[16]
Definition: MachO.h:772
MachO::BindOpcode Opcode
Definition: MachOYAML.h:82
std::vector< FatArch > FatArchs
Definition: MachOYAML.h:137
llvm::yaml::Hex32 reserved
Definition: MachOYAML.h:53
llvm::yaml::Hex64 Other
Definition: MachOYAML.h:95
This class should be specialized by type that requires custom conversion to/from a yaml scalar...
Definition: YAMLTraits.h:137
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef slice(size_t Start, size_t End) const
Return a reference to the substring from [Start, End).
Definition: StringRef.h:710
This file declares classes for handling the YAML representation of Mach-O.
llvm::yaml::Hex32 reserved3
Definition: MachOYAML.h:42
struct fvmlib fvmlib
Definition: MachO.h:590
void setContext(void *)
Definition: YAMLTraits.cpp:47
llvm::yaml::Hex32 cpusubtype
Definition: MachOYAML.h:48
llvm::yaml::Hex32 reloff
Definition: MachOYAML.h:37
char segname[16]
Definition: MachO.h:553
std::vector< NListEntry > NameList
Definition: MachOYAML.h:106
uint32_t reserved3
Definition: MachO.h:577
char sectname[16]
Definition: MachO.h:552
void mapLoadCommandData(IO &IO, MachOYAML::LoadCommand &LoadCommand)
Definition: MachOYAML.cpp:199
llvm::yaml::Hex32 reserved2
Definition: MachOYAML.h:41
virtual bool outputting()=0
llvm::yaml::Hex8 n_type
Definition: MachOYAML.h:69
uint32_t addr
Definition: MachO.h:554
llvm::yaml::Hex32 flags
Definition: MachOYAML.h:39
uint32_t nreloc
Definition: MachO.h:559
uint32_t timestamp
Definition: MachO.h:595
uint32_t offset
Definition: MachO.h:556
llvm::yaml::Hex32 filetype
Definition: MachOYAML.h:49
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:44
std::vector< StringRef > StringTable
Definition: MachOYAML.h:107
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
uint32_t reserved2
Definition: MachO.h:562
void mapRequired(const char *Key, T &Val)
Definition: YAMLTraits.h:646
uint32_t minor_version
Definition: MachO.h:582
uint32_t align
Definition: MachO.h:557
llvm::MachO::macho_load_command Data
Definition: MachOYAML.h:59
uint32_t current_version
Definition: MachO.h:596
llvm::yaml::Hex32 reserved
Definition: MachOYAML.h:132
std::vector< MachOYAML::BindOpcode > LazyBindOpcodes
Definition: MachOYAML.h:104
uint32_t compatibility_version
Definition: MachO.h:597
uint32_t name
Definition: MachO.h:581
llvm::yaml::Hex32 reserved1
Definition: MachOYAML.h:40
llvm::yaml::Hex32 magic
Definition: MachOYAML.h:46
raw_ostream::uuid_t uuid_t
Definition: MachOYAML.h:269