LLVM  8.0.1
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 
44 StringRef ScalarTraits<char_16>::input(StringRef Scalar, void *, char_16 &Val) {
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 
55 QuotingType ScalarTraits<char_16>::mustQuote(StringRef S) {
56  return needsQuotes(S);
57 }
58 
59 void ScalarTraits<uuid_t>::output(const uuid_t &Val, void *, raw_ostream &Out) {
60  Out.write_uuid(Val);
61 }
62 
63 StringRef ScalarTraits<uuid_t>::input(StringRef Scalar, void *, uuid_t &Val) {
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 
80 QuotingType ScalarTraits<uuid_t>::mustQuote(StringRef S) {
81  return needsQuotes(S);
82 }
83 
85  IO &IO, MachOYAML::FileHeader &FileHdr) {
86  IO.mapRequired("magic", FileHdr.magic);
87  IO.mapRequired("cputype", FileHdr.cputype);
88  IO.mapRequired("cpusubtype", FileHdr.cpusubtype);
89  IO.mapRequired("filetype", FileHdr.filetype);
90  IO.mapRequired("ncmds", FileHdr.ncmds);
91  IO.mapRequired("sizeofcmds", FileHdr.sizeofcmds);
92  IO.mapRequired("flags", FileHdr.flags);
93  if (FileHdr.magic == MachO::MH_MAGIC_64 ||
94  FileHdr.magic == MachO::MH_CIGAM_64)
95  IO.mapRequired("reserved", FileHdr.reserved);
96 }
97 
99  MachOYAML::Object &Object) {
100  // If the context isn't already set, tag the document as !mach-o.
101  // For Fat files there will be a different tag so they can be differentiated.
102  if (!IO.getContext()) {
103  IO.setContext(&Object);
104  }
105  IO.mapTag("!mach-o", true);
106  IO.mapOptional("IsLittleEndian", Object.IsLittleEndian,
108  Object.DWARF.IsLittleEndian = Object.IsLittleEndian;
109 
110  IO.mapRequired("FileHeader", Object.Header);
111  IO.mapOptional("LoadCommands", Object.LoadCommands);
112  if(!Object.LinkEdit.isEmpty() || !IO.outputting())
113  IO.mapOptional("LinkEditData", Object.LinkEdit);
114 
115  if(!Object.DWARF.isEmpty() || !IO.outputting())
116  IO.mapOptional("DWARF", Object.DWARF);
117 
118  if (IO.getContext() == &Object)
119  IO.setContext(nullptr);
120 }
121 
123  IO &IO, MachOYAML::FatHeader &FatHeader) {
124  IO.mapRequired("magic", FatHeader.magic);
125  IO.mapRequired("nfat_arch", FatHeader.nfat_arch);
126 }
127 
129  MachOYAML::FatArch &FatArch) {
130  IO.mapRequired("cputype", FatArch.cputype);
131  IO.mapRequired("cpusubtype", FatArch.cpusubtype);
132  IO.mapRequired("offset", FatArch.offset);
133  IO.mapRequired("size", FatArch.size);
134  IO.mapRequired("align", FatArch.align);
135  IO.mapOptional("reserved", FatArch.reserved,
136  static_cast<llvm::yaml::Hex32>(0));
137 }
138 
140  IO &IO, MachOYAML::UniversalBinary &UniversalBinary) {
141  if (!IO.getContext()) {
142  IO.setContext(&UniversalBinary);
143  IO.mapTag("!fat-mach-o", true);
144  }
145  IO.mapRequired("FatHeader", UniversalBinary.Header);
146  IO.mapRequired("FatArchs", UniversalBinary.FatArchs);
147  IO.mapRequired("Slices", UniversalBinary.Slices);
148 
149  if (IO.getContext() == &UniversalBinary)
150  IO.setContext(nullptr);
151 }
152 
154  IO &IO, MachOYAML::LinkEditData &LinkEditData) {
155  IO.mapOptional("RebaseOpcodes", LinkEditData.RebaseOpcodes);
156  IO.mapOptional("BindOpcodes", LinkEditData.BindOpcodes);
157  IO.mapOptional("WeakBindOpcodes", LinkEditData.WeakBindOpcodes);
158  IO.mapOptional("LazyBindOpcodes", LinkEditData.LazyBindOpcodes);
159  if (!LinkEditData.ExportTrie.Children.empty() || !IO.outputting())
160  IO.mapOptional("ExportTrie", LinkEditData.ExportTrie);
161  IO.mapOptional("NameList", LinkEditData.NameList);
162  IO.mapOptional("StringTable", LinkEditData.StringTable);
163 }
164 
167  IO.mapRequired("Opcode", RebaseOpcode.Opcode);
168  IO.mapRequired("Imm", RebaseOpcode.Imm);
169  IO.mapOptional("ExtraData", RebaseOpcode.ExtraData);
170 }
171 
174  IO.mapRequired("Opcode", BindOpcode.Opcode);
175  IO.mapRequired("Imm", BindOpcode.Imm);
176  IO.mapOptional("ULEBExtraData", BindOpcode.ULEBExtraData);
177  IO.mapOptional("SLEBExtraData", BindOpcode.SLEBExtraData);
178  IO.mapOptional("Symbol", BindOpcode.Symbol);
179 }
180 
182  IO &IO, MachOYAML::ExportEntry &ExportEntry) {
183  IO.mapRequired("TerminalSize", ExportEntry.TerminalSize);
184  IO.mapOptional("NodeOffset", ExportEntry.NodeOffset);
185  IO.mapOptional("Name", ExportEntry.Name);
186  IO.mapOptional("Flags", ExportEntry.Flags);
187  IO.mapOptional("Address", ExportEntry.Address);
188  IO.mapOptional("Other", ExportEntry.Other);
189  IO.mapOptional("ImportName", ExportEntry.ImportName);
190  IO.mapOptional("Children", ExportEntry.Children);
191 }
192 
194  IO &IO, MachOYAML::NListEntry &NListEntry) {
195  IO.mapRequired("n_strx", NListEntry.n_strx);
196  IO.mapRequired("n_type", NListEntry.n_type);
197  IO.mapRequired("n_sect", NListEntry.n_sect);
198  IO.mapRequired("n_desc", NListEntry.n_desc);
199  IO.mapRequired("n_value", NListEntry.n_value);
200 }
201 
202 template <typename StructType>
203 void mapLoadCommandData(IO &IO, MachOYAML::LoadCommand &LoadCommand) {}
204 
205 template <>
206 void mapLoadCommandData<MachO::segment_command>(
207  IO &IO, MachOYAML::LoadCommand &LoadCommand) {
208  IO.mapOptional("Sections", LoadCommand.Sections);
209 }
210 
211 template <>
212 void mapLoadCommandData<MachO::segment_command_64>(
213  IO &IO, MachOYAML::LoadCommand &LoadCommand) {
214  IO.mapOptional("Sections", LoadCommand.Sections);
215 }
216 
217 template <>
218 void mapLoadCommandData<MachO::dylib_command>(
219  IO &IO, MachOYAML::LoadCommand &LoadCommand) {
220  IO.mapOptional("PayloadString", LoadCommand.PayloadString);
221 }
222 
223 template <>
224 void mapLoadCommandData<MachO::rpath_command>(
225  IO &IO, MachOYAML::LoadCommand &LoadCommand) {
226  IO.mapOptional("PayloadString", LoadCommand.PayloadString);
227 }
228 
229 template <>
230 void mapLoadCommandData<MachO::dylinker_command>(
231  IO &IO, MachOYAML::LoadCommand &LoadCommand) {
232  IO.mapOptional("PayloadString", LoadCommand.PayloadString);
233 }
234 
235 template <>
236 void mapLoadCommandData<MachO::build_version_command>(
237  IO &IO, MachOYAML::LoadCommand &LoadCommand) {
238  IO.mapOptional("Tools", LoadCommand.Tools);
239 }
240 
242  IO &IO, MachOYAML::LoadCommand &LoadCommand) {
243  MachO::LoadCommandType TempCmd = static_cast<MachO::LoadCommandType>(
244  LoadCommand.Data.load_command_data.cmd);
245  IO.mapRequired("cmd", TempCmd);
246  LoadCommand.Data.load_command_data.cmd = TempCmd;
247  IO.mapRequired("cmdsize", LoadCommand.Data.load_command_data.cmdsize);
248 
249 #define HANDLE_LOAD_COMMAND(LCName, LCValue, LCStruct) \
250  case MachO::LCName: \
251  MappingTraits<MachO::LCStruct>::mapping(IO, \
252  LoadCommand.Data.LCStruct##_data); \
253  mapLoadCommandData<MachO::LCStruct>(IO, LoadCommand); \
254  break;
255 
256  switch (LoadCommand.Data.load_command_data.cmd) {
257 #include "llvm/BinaryFormat/MachO.def"
258  }
259  IO.mapOptional("PayloadBytes", LoadCommand.PayloadBytes);
260  IO.mapOptional("ZeroPadBytes", LoadCommand.ZeroPadBytes, (uint64_t)0ull);
261 }
262 
264  IO &IO, MachO::dyld_info_command &LoadCommand) {
265  IO.mapRequired("rebase_off", LoadCommand.rebase_off);
266  IO.mapRequired("rebase_size", LoadCommand.rebase_size);
267  IO.mapRequired("bind_off", LoadCommand.bind_off);
268  IO.mapRequired("bind_size", LoadCommand.bind_size);
269  IO.mapRequired("weak_bind_off", LoadCommand.weak_bind_off);
270  IO.mapRequired("weak_bind_size", LoadCommand.weak_bind_size);
271  IO.mapRequired("lazy_bind_off", LoadCommand.lazy_bind_off);
272  IO.mapRequired("lazy_bind_size", LoadCommand.lazy_bind_size);
273  IO.mapRequired("export_off", LoadCommand.export_off);
274  IO.mapRequired("export_size", LoadCommand.export_size);
275 }
276 
279  IO.mapRequired("sectname", Section.sectname);
280  IO.mapRequired("segname", Section.segname);
281  IO.mapRequired("addr", Section.addr);
282  IO.mapRequired("size", Section.size);
283  IO.mapRequired("offset", Section.offset);
284  IO.mapRequired("align", Section.align);
285  IO.mapRequired("reloff", Section.reloff);
286  IO.mapRequired("nreloc", Section.nreloc);
287  IO.mapRequired("flags", Section.flags);
288  IO.mapRequired("reserved1", Section.reserved1);
289  IO.mapRequired("reserved2", Section.reserved2);
290  IO.mapOptional("reserved3", Section.reserved3);
291 }
292 
294  IO &IO, MachO::build_tool_version &tool) {
295  IO.mapRequired("tool", tool.tool);
296  IO.mapRequired("version", tool.version);
297 }
298 
300  IO.mapRequired("name", DylibStruct.name);
301  IO.mapRequired("timestamp", DylibStruct.timestamp);
302  IO.mapRequired("current_version", DylibStruct.current_version);
303  IO.mapRequired("compatibility_version", DylibStruct.compatibility_version);
304 }
305 
307  IO &IO, MachO::dylib_command &LoadCommand) {
308  IO.mapRequired("dylib", LoadCommand.dylib);
309 }
310 
312  IO &IO, MachO::dylinker_command &LoadCommand) {
313  IO.mapRequired("name", LoadCommand.name);
314 }
315 
317  IO &IO, MachO::dysymtab_command &LoadCommand) {
318  IO.mapRequired("ilocalsym", LoadCommand.ilocalsym);
319  IO.mapRequired("nlocalsym", LoadCommand.nlocalsym);
320  IO.mapRequired("iextdefsym", LoadCommand.iextdefsym);
321  IO.mapRequired("nextdefsym", LoadCommand.nextdefsym);
322  IO.mapRequired("iundefsym", LoadCommand.iundefsym);
323  IO.mapRequired("nundefsym", LoadCommand.nundefsym);
324  IO.mapRequired("tocoff", LoadCommand.tocoff);
325  IO.mapRequired("ntoc", LoadCommand.ntoc);
326  IO.mapRequired("modtaboff", LoadCommand.modtaboff);
327  IO.mapRequired("nmodtab", LoadCommand.nmodtab);
328  IO.mapRequired("extrefsymoff", LoadCommand.extrefsymoff);
329  IO.mapRequired("nextrefsyms", LoadCommand.nextrefsyms);
330  IO.mapRequired("indirectsymoff", LoadCommand.indirectsymoff);
331  IO.mapRequired("nindirectsyms", LoadCommand.nindirectsyms);
332  IO.mapRequired("extreloff", LoadCommand.extreloff);
333  IO.mapRequired("nextrel", LoadCommand.nextrel);
334  IO.mapRequired("locreloff", LoadCommand.locreloff);
335  IO.mapRequired("nlocrel", LoadCommand.nlocrel);
336 }
337 
339  IO &IO, MachO::encryption_info_command &LoadCommand) {
340  IO.mapRequired("cryptoff", LoadCommand.cryptoff);
341  IO.mapRequired("cryptsize", LoadCommand.cryptsize);
342  IO.mapRequired("cryptid", LoadCommand.cryptid);
343 }
344 
346  IO &IO, MachO::encryption_info_command_64 &LoadCommand) {
347  IO.mapRequired("cryptoff", LoadCommand.cryptoff);
348  IO.mapRequired("cryptsize", LoadCommand.cryptsize);
349  IO.mapRequired("cryptid", LoadCommand.cryptid);
350  IO.mapRequired("pad", LoadCommand.pad);
351 }
352 
354  IO &IO, MachO::entry_point_command &LoadCommand) {
355  IO.mapRequired("entryoff", LoadCommand.entryoff);
356  IO.mapRequired("stacksize", LoadCommand.stacksize);
357 }
358 
360  IO &IO, MachO::fvmfile_command &LoadCommand) {
361  IO.mapRequired("name", LoadCommand.name);
362  IO.mapRequired("header_addr", LoadCommand.header_addr);
363 }
364 
366  IO.mapRequired("name", FVMLib.name);
367  IO.mapRequired("minor_version", FVMLib.minor_version);
368  IO.mapRequired("header_addr", FVMLib.header_addr);
369 }
370 
372  IO &IO, MachO::fvmlib_command &LoadCommand) {
373  IO.mapRequired("fvmlib", LoadCommand.fvmlib);
374 }
375 
377  IO &IO, MachO::ident_command &LoadCommand) {}
378 
380  IO &IO, MachO::linkedit_data_command &LoadCommand) {
381  IO.mapRequired("dataoff", LoadCommand.dataoff);
382  IO.mapRequired("datasize", LoadCommand.datasize);
383 }
384 
386  IO &IO, MachO::linker_option_command &LoadCommand) {
387  IO.mapRequired("count", LoadCommand.count);
388 }
389 
391  IO &IO, MachO::prebind_cksum_command &LoadCommand) {
392  IO.mapRequired("cksum", LoadCommand.cksum);
393 }
394 
396  IO &IO, MachO::load_command &LoadCommand) {}
397 
399  IO &IO, MachO::prebound_dylib_command &LoadCommand) {
400  IO.mapRequired("name", LoadCommand.name);
401  IO.mapRequired("nmodules", LoadCommand.nmodules);
402  IO.mapRequired("linked_modules", LoadCommand.linked_modules);
403 }
404 
406  IO &IO, MachO::routines_command &LoadCommand) {
407  IO.mapRequired("init_address", LoadCommand.init_address);
408  IO.mapRequired("init_module", LoadCommand.init_module);
409  IO.mapRequired("reserved1", LoadCommand.reserved1);
410  IO.mapRequired("reserved2", LoadCommand.reserved2);
411  IO.mapRequired("reserved3", LoadCommand.reserved3);
412  IO.mapRequired("reserved4", LoadCommand.reserved4);
413  IO.mapRequired("reserved5", LoadCommand.reserved5);
414  IO.mapRequired("reserved6", LoadCommand.reserved6);
415 }
416 
418  IO &IO, MachO::routines_command_64 &LoadCommand) {
419  IO.mapRequired("init_address", LoadCommand.init_address);
420  IO.mapRequired("init_module", LoadCommand.init_module);
421  IO.mapRequired("reserved1", LoadCommand.reserved1);
422  IO.mapRequired("reserved2", LoadCommand.reserved2);
423  IO.mapRequired("reserved3", LoadCommand.reserved3);
424  IO.mapRequired("reserved4", LoadCommand.reserved4);
425  IO.mapRequired("reserved5", LoadCommand.reserved5);
426  IO.mapRequired("reserved6", LoadCommand.reserved6);
427 }
428 
430  IO &IO, MachO::rpath_command &LoadCommand) {
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  IO.mapRequired("segname", LoadCommand.segname);
467  IO.mapRequired("vmaddr", LoadCommand.vmaddr);
468  IO.mapRequired("vmsize", LoadCommand.vmsize);
469  IO.mapRequired("fileoff", LoadCommand.fileoff);
470  IO.mapRequired("filesize", LoadCommand.filesize);
471  IO.mapRequired("maxprot", LoadCommand.maxprot);
472  IO.mapRequired("initprot", LoadCommand.initprot);
473  IO.mapRequired("nsects", LoadCommand.nsects);
474  IO.mapRequired("flags", LoadCommand.flags);
475 }
476 
478  IO &IO, MachO::segment_command_64 &LoadCommand) {
479  IO.mapRequired("segname", LoadCommand.segname);
480  IO.mapRequired("vmaddr", LoadCommand.vmaddr);
481  IO.mapRequired("vmsize", LoadCommand.vmsize);
482  IO.mapRequired("fileoff", LoadCommand.fileoff);
483  IO.mapRequired("filesize", LoadCommand.filesize);
484  IO.mapRequired("maxprot", LoadCommand.maxprot);
485  IO.mapRequired("initprot", LoadCommand.initprot);
486  IO.mapRequired("nsects", LoadCommand.nsects);
487  IO.mapRequired("flags", LoadCommand.flags);
488 }
489 
491  IO &IO, MachO::source_version_command &LoadCommand) {
492  IO.mapRequired("version", LoadCommand.version);
493 }
494 
496  IO &IO, MachO::sub_client_command &LoadCommand) {
497  IO.mapRequired("client", LoadCommand.client);
498 }
499 
501  IO &IO, MachO::sub_framework_command &LoadCommand) {
502  IO.mapRequired("umbrella", LoadCommand.umbrella);
503 }
504 
506  IO &IO, MachO::sub_library_command &LoadCommand) {
507  IO.mapRequired("sub_library", LoadCommand.sub_library);
508 }
509 
511  IO &IO, MachO::sub_umbrella_command &LoadCommand) {
512  IO.mapRequired("sub_umbrella", LoadCommand.sub_umbrella);
513 }
514 
516  IO &IO, MachO::symseg_command &LoadCommand) {
517  IO.mapRequired("offset", LoadCommand.offset);
518  IO.mapRequired("size", LoadCommand.size);
519 }
520 
522  IO &IO, MachO::symtab_command &LoadCommand) {
523  IO.mapRequired("symoff", LoadCommand.symoff);
524  IO.mapRequired("nsyms", LoadCommand.nsyms);
525  IO.mapRequired("stroff", LoadCommand.stroff);
526  IO.mapRequired("strsize", LoadCommand.strsize);
527 }
528 
530  IO &IO, MachO::thread_command &LoadCommand) {}
531 
533  IO &IO, MachO::twolevel_hints_command &LoadCommand) {
534  IO.mapRequired("offset", LoadCommand.offset);
535  IO.mapRequired("nhints", LoadCommand.nhints);
536 }
537 
539  IO &IO, MachO::uuid_command &LoadCommand) {
540  IO.mapRequired("uuid", LoadCommand.uuid);
541 }
542 
544  IO &IO, MachO::version_min_command &LoadCommand) {
545  IO.mapRequired("version", LoadCommand.version);
546  IO.mapRequired("sdk", LoadCommand.sdk);
547 }
548 
550  IO &IO, MachO::note_command &LoadCommand) {
551  IO.mapRequired("data_owner", LoadCommand.data_owner);
552  IO.mapRequired("offset", LoadCommand.offset);
553  IO.mapRequired("size", LoadCommand.size);
554 }
555 
557  IO &IO, MachO::build_version_command &LoadCommand) {
558  IO.mapRequired("platform", LoadCommand.platform);
559  IO.mapRequired("minos", LoadCommand.minos);
560  IO.mapRequired("sdk", LoadCommand.sdk);
561  IO.mapRequired("ntools", LoadCommand.ntools);
562 }
563 
564 } // end namespace yaml
565 
566 } // end namespace llvm
LoadCommandType
Definition: MachO.h:92
uint32_t header_addr
Definition: MachO.h:586
struct dylib dylib
Definition: MachO.h:606
This class represents lattice values for constants.
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:489
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:564
llvm::yaml::Hex64 offset
Definition: MachOYAML.h:129
std::vector< int64_t > SLEBExtraData
Definition: MachOYAML.h:85
char[16] char_16
Definition: MachOYAML.h:259
uint32_t reserved2
Definition: MachO.h:579
uint32_t size
Definition: MachO.h:558
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:597
uint32_t reloff
Definition: MachO.h:561
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
std::vector< yaml::Hex64 > ExtraData
Definition: MachOYAML.h:78
LinkEditData LinkEdit
Definition: MachOYAML.h:117
std::vector< LoadCommand > LoadCommands
Definition: MachOYAML.h:115
uint32_t flags
Definition: MachO.h:563
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:578
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:775
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
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:593
llvm::yaml::Hex32 cpusubtype
Definition: MachOYAML.h:48
llvm::yaml::Hex32 reloff
Definition: MachOYAML.h:37
char segname[16]
Definition: MachO.h:556
std::vector< NListEntry > NameList
Definition: MachOYAML.h:106
uint32_t reserved3
Definition: MachO.h:580
char sectname[16]
Definition: MachO.h:555
void mapLoadCommandData(IO &IO, MachOYAML::LoadCommand &LoadCommand)
Definition: MachOYAML.cpp:203
llvm::yaml::Hex32 reserved2
Definition: MachOYAML.h:41
llvm::yaml::Hex8 n_type
Definition: MachOYAML.h:69
uint32_t addr
Definition: MachO.h:557
llvm::yaml::Hex32 flags
Definition: MachOYAML.h:39
uint32_t nreloc
Definition: MachO.h:562
uint32_t timestamp
Definition: MachO.h:598
uint32_t offset
Definition: MachO.h:559
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:46
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:565
uint32_t minor_version
Definition: MachO.h:585
uint32_t align
Definition: MachO.h:560
llvm::MachO::macho_load_command Data
Definition: MachOYAML.h:59
uint32_t current_version
Definition: MachO.h:599
llvm::yaml::Hex32 reserved
Definition: MachOYAML.h:132
std::vector< MachOYAML::BindOpcode > LazyBindOpcodes
Definition: MachOYAML.h:104
uint32_t compatibility_version
Definition: MachO.h:600
uint32_t name
Definition: MachO.h:584
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