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