LLVM  9.0.0svn
MachOYAML.cpp
Go to the documentation of this file.
1 //===- MachOYAML.cpp - MachO YAMLIO implementation ------------------------===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file defines classes for handling the YAML representation of MachO.
10 //
11 //===----------------------------------------------------------------------===//
12 
14 #include "llvm/ADT/StringRef.h"
16 #include "llvm/Support/Format.h"
17 #include "llvm/Support/Host.h"
20 #include <cinttypes>
21 #include <cstdint>
22 #include <cstring>
23 
24 namespace llvm {
25 
27 
29  return 0 ==
30  RebaseOpcodes.size() + BindOpcodes.size() + WeakBindOpcodes.size() +
31  LazyBindOpcodes.size() + ExportTrie.Children.size() +
32  NameList.size() + StringTable.size();
33 }
34 
35 namespace yaml {
36 
37 void ScalarTraits<char_16>::output(const char_16 &Val, void *,
38  raw_ostream &Out) {
39  auto Len = strnlen(&Val[0], 16);
40  Out << StringRef(&Val[0], Len);
41 }
42 
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);
46 
47  if (Scalar.size() < 16) {
48  memset((void *)&Val[Scalar.size()], 0, 16 - Scalar.size());
49  }
50 
51  return StringRef();
52 }
53 
54 QuotingType ScalarTraits<char_16>::mustQuote(StringRef S) {
55  return needsQuotes(S);
56 }
57 
58 void ScalarTraits<uuid_t>::output(const uuid_t &Val, void *, raw_ostream &Out) {
59  Out.write_uuid(Val);
60 }
61 
62 StringRef ScalarTraits<uuid_t>::input(StringRef Scalar, void *, uuid_t &Val) {
63  size_t OutIdx = 0;
64  for (size_t Idx = 0; Idx < Scalar.size(); ++Idx) {
65  if (Scalar[Idx] == '-' || OutIdx >= 16)
66  continue;
67  unsigned long long TempInt;
68  if (getAsUnsignedInteger(Scalar.slice(Idx, Idx + 2), 16, TempInt))
69  return "invalid number";
70  if (TempInt > 0xFF)
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
74  ++OutIdx;
75  }
76  return StringRef();
77 }
78 
79 QuotingType ScalarTraits<uuid_t>::mustQuote(StringRef S) {
80  return needsQuotes(S);
81 }
82 
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);
95 }
96 
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);
103  }
104  IO.mapTag("!mach-o", true);
105  IO.mapOptional("IsLittleEndian", Object.IsLittleEndian,
107  Object.DWARF.IsLittleEndian = Object.IsLittleEndian;
108 
109  IO.mapRequired("FileHeader", Object.Header);
110  IO.mapOptional("LoadCommands", Object.LoadCommands);
111  if(!Object.LinkEdit.isEmpty() || !IO.outputting())
112  IO.mapOptional("LinkEditData", Object.LinkEdit);
113 
114  if(!Object.DWARF.isEmpty() || !IO.outputting())
115  IO.mapOptional("DWARF", Object.DWARF);
116 
117  if (IO.getContext() == &Object)
118  IO.setContext(nullptr);
119 }
120 
122  IO &IO, MachOYAML::FatHeader &FatHeader) {
123  IO.mapRequired("magic", FatHeader.magic);
124  IO.mapRequired("nfat_arch", FatHeader.nfat_arch);
125 }
126 
128  MachOYAML::FatArch &FatArch) {
129  IO.mapRequired("cputype", FatArch.cputype);
130  IO.mapRequired("cpusubtype", FatArch.cpusubtype);
131  IO.mapRequired("offset", FatArch.offset);
132  IO.mapRequired("size", FatArch.size);
133  IO.mapRequired("align", FatArch.align);
134  IO.mapOptional("reserved", FatArch.reserved,
135  static_cast<llvm::yaml::Hex32>(0));
136 }
137 
139  IO &IO, MachOYAML::UniversalBinary &UniversalBinary) {
140  if (!IO.getContext()) {
141  IO.setContext(&UniversalBinary);
142  IO.mapTag("!fat-mach-o", true);
143  }
144  IO.mapRequired("FatHeader", UniversalBinary.Header);
145  IO.mapRequired("FatArchs", UniversalBinary.FatArchs);
146  IO.mapRequired("Slices", UniversalBinary.Slices);
147 
148  if (IO.getContext() == &UniversalBinary)
149  IO.setContext(nullptr);
150 }
151 
153  IO &IO, MachOYAML::LinkEditData &LinkEditData) {
154  IO.mapOptional("RebaseOpcodes", LinkEditData.RebaseOpcodes);
155  IO.mapOptional("BindOpcodes", LinkEditData.BindOpcodes);
156  IO.mapOptional("WeakBindOpcodes", LinkEditData.WeakBindOpcodes);
157  IO.mapOptional("LazyBindOpcodes", LinkEditData.LazyBindOpcodes);
158  if (!LinkEditData.ExportTrie.Children.empty() || !IO.outputting())
159  IO.mapOptional("ExportTrie", LinkEditData.ExportTrie);
160  IO.mapOptional("NameList", LinkEditData.NameList);
161  IO.mapOptional("StringTable", LinkEditData.StringTable);
162 }
163 
166  IO.mapRequired("Opcode", RebaseOpcode.Opcode);
167  IO.mapRequired("Imm", RebaseOpcode.Imm);
168  IO.mapOptional("ExtraData", RebaseOpcode.ExtraData);
169 }
170 
173  IO.mapRequired("Opcode", BindOpcode.Opcode);
174  IO.mapRequired("Imm", BindOpcode.Imm);
175  IO.mapOptional("ULEBExtraData", BindOpcode.ULEBExtraData);
176  IO.mapOptional("SLEBExtraData", BindOpcode.SLEBExtraData);
177  IO.mapOptional("Symbol", BindOpcode.Symbol);
178 }
179 
181  IO &IO, MachOYAML::ExportEntry &ExportEntry) {
182  IO.mapRequired("TerminalSize", ExportEntry.TerminalSize);
183  IO.mapOptional("NodeOffset", ExportEntry.NodeOffset);
184  IO.mapOptional("Name", ExportEntry.Name);
185  IO.mapOptional("Flags", ExportEntry.Flags);
186  IO.mapOptional("Address", ExportEntry.Address);
187  IO.mapOptional("Other", ExportEntry.Other);
188  IO.mapOptional("ImportName", ExportEntry.ImportName);
189  IO.mapOptional("Children", ExportEntry.Children);
190 }
191 
193  IO &IO, MachOYAML::NListEntry &NListEntry) {
194  IO.mapRequired("n_strx", NListEntry.n_strx);
195  IO.mapRequired("n_type", NListEntry.n_type);
196  IO.mapRequired("n_sect", NListEntry.n_sect);
197  IO.mapRequired("n_desc", NListEntry.n_desc);
198  IO.mapRequired("n_value", NListEntry.n_value);
199 }
200 
201 template <typename StructType>
202 void mapLoadCommandData(IO &IO, MachOYAML::LoadCommand &LoadCommand) {}
203 
204 template <>
205 void mapLoadCommandData<MachO::segment_command>(
206  IO &IO, MachOYAML::LoadCommand &LoadCommand) {
207  IO.mapOptional("Sections", LoadCommand.Sections);
208 }
209 
210 template <>
211 void mapLoadCommandData<MachO::segment_command_64>(
212  IO &IO, MachOYAML::LoadCommand &LoadCommand) {
213  IO.mapOptional("Sections", LoadCommand.Sections);
214 }
215 
216 template <>
217 void mapLoadCommandData<MachO::dylib_command>(
218  IO &IO, MachOYAML::LoadCommand &LoadCommand) {
219  IO.mapOptional("PayloadString", LoadCommand.PayloadString);
220 }
221 
222 template <>
223 void mapLoadCommandData<MachO::rpath_command>(
224  IO &IO, MachOYAML::LoadCommand &LoadCommand) {
225  IO.mapOptional("PayloadString", LoadCommand.PayloadString);
226 }
227 
228 template <>
229 void mapLoadCommandData<MachO::dylinker_command>(
230  IO &IO, MachOYAML::LoadCommand &LoadCommand) {
231  IO.mapOptional("PayloadString", LoadCommand.PayloadString);
232 }
233 
234 template <>
235 void mapLoadCommandData<MachO::build_version_command>(
236  IO &IO, MachOYAML::LoadCommand &LoadCommand) {
237  IO.mapOptional("Tools", LoadCommand.Tools);
238 }
239 
241  IO &IO, MachOYAML::LoadCommand &LoadCommand) {
242  MachO::LoadCommandType TempCmd = static_cast<MachO::LoadCommandType>(
243  LoadCommand.Data.load_command_data.cmd);
244  IO.mapRequired("cmd", TempCmd);
245  LoadCommand.Data.load_command_data.cmd = TempCmd;
246  IO.mapRequired("cmdsize", LoadCommand.Data.load_command_data.cmdsize);
247 
248 #define HANDLE_LOAD_COMMAND(LCName, LCValue, LCStruct) \
249  case MachO::LCName: \
250  MappingTraits<MachO::LCStruct>::mapping(IO, \
251  LoadCommand.Data.LCStruct##_data); \
252  mapLoadCommandData<MachO::LCStruct>(IO, LoadCommand); \
253  break;
254 
255  switch (LoadCommand.Data.load_command_data.cmd) {
256 #include "llvm/BinaryFormat/MachO.def"
257  }
258  IO.mapOptional("PayloadBytes", LoadCommand.PayloadBytes);
259  IO.mapOptional("ZeroPadBytes", LoadCommand.ZeroPadBytes, (uint64_t)0ull);
260 }
261 
263  IO &IO, MachO::dyld_info_command &LoadCommand) {
264  IO.mapRequired("rebase_off", LoadCommand.rebase_off);
265  IO.mapRequired("rebase_size", LoadCommand.rebase_size);
266  IO.mapRequired("bind_off", LoadCommand.bind_off);
267  IO.mapRequired("bind_size", LoadCommand.bind_size);
268  IO.mapRequired("weak_bind_off", LoadCommand.weak_bind_off);
269  IO.mapRequired("weak_bind_size", LoadCommand.weak_bind_size);
270  IO.mapRequired("lazy_bind_off", LoadCommand.lazy_bind_off);
271  IO.mapRequired("lazy_bind_size", LoadCommand.lazy_bind_size);
272  IO.mapRequired("export_off", LoadCommand.export_off);
273  IO.mapRequired("export_size", LoadCommand.export_size);
274 }
275 
278  IO.mapRequired("sectname", Section.sectname);
279  IO.mapRequired("segname", Section.segname);
280  IO.mapRequired("addr", Section.addr);
281  IO.mapRequired("size", Section.size);
282  IO.mapRequired("offset", Section.offset);
283  IO.mapRequired("align", Section.align);
284  IO.mapRequired("reloff", Section.reloff);
285  IO.mapRequired("nreloc", Section.nreloc);
286  IO.mapRequired("flags", Section.flags);
287  IO.mapRequired("reserved1", Section.reserved1);
288  IO.mapRequired("reserved2", Section.reserved2);
289  IO.mapOptional("reserved3", Section.reserved3);
290 }
291 
293  IO &IO, MachO::build_tool_version &tool) {
294  IO.mapRequired("tool", tool.tool);
295  IO.mapRequired("version", tool.version);
296 }
297 
299  IO.mapRequired("name", DylibStruct.name);
300  IO.mapRequired("timestamp", DylibStruct.timestamp);
301  IO.mapRequired("current_version", DylibStruct.current_version);
302  IO.mapRequired("compatibility_version", DylibStruct.compatibility_version);
303 }
304 
306  IO &IO, MachO::dylib_command &LoadCommand) {
307  IO.mapRequired("dylib", LoadCommand.dylib);
308 }
309 
311  IO &IO, MachO::dylinker_command &LoadCommand) {
312  IO.mapRequired("name", LoadCommand.name);
313 }
314 
316  IO &IO, MachO::dysymtab_command &LoadCommand) {
317  IO.mapRequired("ilocalsym", LoadCommand.ilocalsym);
318  IO.mapRequired("nlocalsym", LoadCommand.nlocalsym);
319  IO.mapRequired("iextdefsym", LoadCommand.iextdefsym);
320  IO.mapRequired("nextdefsym", LoadCommand.nextdefsym);
321  IO.mapRequired("iundefsym", LoadCommand.iundefsym);
322  IO.mapRequired("nundefsym", LoadCommand.nundefsym);
323  IO.mapRequired("tocoff", LoadCommand.tocoff);
324  IO.mapRequired("ntoc", LoadCommand.ntoc);
325  IO.mapRequired("modtaboff", LoadCommand.modtaboff);
326  IO.mapRequired("nmodtab", LoadCommand.nmodtab);
327  IO.mapRequired("extrefsymoff", LoadCommand.extrefsymoff);
328  IO.mapRequired("nextrefsyms", LoadCommand.nextrefsyms);
329  IO.mapRequired("indirectsymoff", LoadCommand.indirectsymoff);
330  IO.mapRequired("nindirectsyms", LoadCommand.nindirectsyms);
331  IO.mapRequired("extreloff", LoadCommand.extreloff);
332  IO.mapRequired("nextrel", LoadCommand.nextrel);
333  IO.mapRequired("locreloff", LoadCommand.locreloff);
334  IO.mapRequired("nlocrel", LoadCommand.nlocrel);
335 }
336 
338  IO &IO, MachO::encryption_info_command &LoadCommand) {
339  IO.mapRequired("cryptoff", LoadCommand.cryptoff);
340  IO.mapRequired("cryptsize", LoadCommand.cryptsize);
341  IO.mapRequired("cryptid", LoadCommand.cryptid);
342 }
343 
345  IO &IO, MachO::encryption_info_command_64 &LoadCommand) {
346  IO.mapRequired("cryptoff", LoadCommand.cryptoff);
347  IO.mapRequired("cryptsize", LoadCommand.cryptsize);
348  IO.mapRequired("cryptid", LoadCommand.cryptid);
349  IO.mapRequired("pad", LoadCommand.pad);
350 }
351 
353  IO &IO, MachO::entry_point_command &LoadCommand) {
354  IO.mapRequired("entryoff", LoadCommand.entryoff);
355  IO.mapRequired("stacksize", LoadCommand.stacksize);
356 }
357 
359  IO &IO, MachO::fvmfile_command &LoadCommand) {
360  IO.mapRequired("name", LoadCommand.name);
361  IO.mapRequired("header_addr", LoadCommand.header_addr);
362 }
363 
365  IO.mapRequired("name", FVMLib.name);
366  IO.mapRequired("minor_version", FVMLib.minor_version);
367  IO.mapRequired("header_addr", FVMLib.header_addr);
368 }
369 
371  IO &IO, MachO::fvmlib_command &LoadCommand) {
372  IO.mapRequired("fvmlib", LoadCommand.fvmlib);
373 }
374 
376  IO &IO, MachO::ident_command &LoadCommand) {}
377 
379  IO &IO, MachO::linkedit_data_command &LoadCommand) {
380  IO.mapRequired("dataoff", LoadCommand.dataoff);
381  IO.mapRequired("datasize", LoadCommand.datasize);
382 }
383 
385  IO &IO, MachO::linker_option_command &LoadCommand) {
386  IO.mapRequired("count", LoadCommand.count);
387 }
388 
390  IO &IO, MachO::prebind_cksum_command &LoadCommand) {
391  IO.mapRequired("cksum", LoadCommand.cksum);
392 }
393 
395  IO &IO, MachO::load_command &LoadCommand) {}
396 
398  IO &IO, MachO::prebound_dylib_command &LoadCommand) {
399  IO.mapRequired("name", LoadCommand.name);
400  IO.mapRequired("nmodules", LoadCommand.nmodules);
401  IO.mapRequired("linked_modules", LoadCommand.linked_modules);
402 }
403 
405  IO &IO, MachO::routines_command &LoadCommand) {
406  IO.mapRequired("init_address", LoadCommand.init_address);
407  IO.mapRequired("init_module", LoadCommand.init_module);
408  IO.mapRequired("reserved1", LoadCommand.reserved1);
409  IO.mapRequired("reserved2", LoadCommand.reserved2);
410  IO.mapRequired("reserved3", LoadCommand.reserved3);
411  IO.mapRequired("reserved4", LoadCommand.reserved4);
412  IO.mapRequired("reserved5", LoadCommand.reserved5);
413  IO.mapRequired("reserved6", LoadCommand.reserved6);
414 }
415 
417  IO &IO, MachO::routines_command_64 &LoadCommand) {
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 
429  IO &IO, MachO::rpath_command &LoadCommand) {
430  IO.mapRequired("path", LoadCommand.path);
431 }
432 
434  IO.mapRequired("sectname", Section.sectname);
435  IO.mapRequired("segname", Section.segname);
436  IO.mapRequired("addr", Section.addr);
437  IO.mapRequired("size", Section.size);
438  IO.mapRequired("offset", Section.offset);
439  IO.mapRequired("align", Section.align);
440  IO.mapRequired("reloff", Section.reloff);
441  IO.mapRequired("nreloc", Section.nreloc);
442  IO.mapRequired("flags", Section.flags);
443  IO.mapRequired("reserved1", Section.reserved1);
444  IO.mapRequired("reserved2", Section.reserved2);
445 }
446 
449  IO.mapRequired("sectname", Section.sectname);
450  IO.mapRequired("segname", Section.segname);
451  IO.mapRequired("addr", Section.addr);
452  IO.mapRequired("size", Section.size);
453  IO.mapRequired("offset", Section.offset);
454  IO.mapRequired("align", Section.align);
455  IO.mapRequired("reloff", Section.reloff);
456  IO.mapRequired("nreloc", Section.nreloc);
457  IO.mapRequired("flags", Section.flags);
458  IO.mapRequired("reserved1", Section.reserved1);
459  IO.mapRequired("reserved2", Section.reserved2);
460  IO.mapRequired("reserved3", Section.reserved3);
461 }
462 
464  IO &IO, MachO::segment_command &LoadCommand) {
465  IO.mapRequired("segname", LoadCommand.segname);
466  IO.mapRequired("vmaddr", LoadCommand.vmaddr);
467  IO.mapRequired("vmsize", LoadCommand.vmsize);
468  IO.mapRequired("fileoff", LoadCommand.fileoff);
469  IO.mapRequired("filesize", LoadCommand.filesize);
470  IO.mapRequired("maxprot", LoadCommand.maxprot);
471  IO.mapRequired("initprot", LoadCommand.initprot);
472  IO.mapRequired("nsects", LoadCommand.nsects);
473  IO.mapRequired("flags", LoadCommand.flags);
474 }
475 
477  IO &IO, MachO::segment_command_64 &LoadCommand) {
478  IO.mapRequired("segname", LoadCommand.segname);
479  IO.mapRequired("vmaddr", LoadCommand.vmaddr);
480  IO.mapRequired("vmsize", LoadCommand.vmsize);
481  IO.mapRequired("fileoff", LoadCommand.fileoff);
482  IO.mapRequired("filesize", LoadCommand.filesize);
483  IO.mapRequired("maxprot", LoadCommand.maxprot);
484  IO.mapRequired("initprot", LoadCommand.initprot);
485  IO.mapRequired("nsects", LoadCommand.nsects);
486  IO.mapRequired("flags", LoadCommand.flags);
487 }
488 
490  IO &IO, MachO::source_version_command &LoadCommand) {
491  IO.mapRequired("version", LoadCommand.version);
492 }
493 
495  IO &IO, MachO::sub_client_command &LoadCommand) {
496  IO.mapRequired("client", LoadCommand.client);
497 }
498 
500  IO &IO, MachO::sub_framework_command &LoadCommand) {
501  IO.mapRequired("umbrella", LoadCommand.umbrella);
502 }
503 
505  IO &IO, MachO::sub_library_command &LoadCommand) {
506  IO.mapRequired("sub_library", LoadCommand.sub_library);
507 }
508 
510  IO &IO, MachO::sub_umbrella_command &LoadCommand) {
511  IO.mapRequired("sub_umbrella", LoadCommand.sub_umbrella);
512 }
513 
515  IO &IO, MachO::symseg_command &LoadCommand) {
516  IO.mapRequired("offset", LoadCommand.offset);
517  IO.mapRequired("size", LoadCommand.size);
518 }
519 
521  IO &IO, MachO::symtab_command &LoadCommand) {
522  IO.mapRequired("symoff", LoadCommand.symoff);
523  IO.mapRequired("nsyms", LoadCommand.nsyms);
524  IO.mapRequired("stroff", LoadCommand.stroff);
525  IO.mapRequired("strsize", LoadCommand.strsize);
526 }
527 
529  IO &IO, MachO::thread_command &LoadCommand) {}
530 
532  IO &IO, MachO::twolevel_hints_command &LoadCommand) {
533  IO.mapRequired("offset", LoadCommand.offset);
534  IO.mapRequired("nhints", LoadCommand.nhints);
535 }
536 
538  IO &IO, MachO::uuid_command &LoadCommand) {
539  IO.mapRequired("uuid", LoadCommand.uuid);
540 }
541 
543  IO &IO, MachO::version_min_command &LoadCommand) {
544  IO.mapRequired("version", LoadCommand.version);
545  IO.mapRequired("sdk", LoadCommand.sdk);
546 }
547 
549  IO &IO, MachO::note_command &LoadCommand) {
550  IO.mapRequired("data_owner", LoadCommand.data_owner);
551  IO.mapRequired("offset", LoadCommand.offset);
552  IO.mapRequired("size", LoadCommand.size);
553 }
554 
556  IO &IO, MachO::build_version_command &LoadCommand) {
557  IO.mapRequired("platform", LoadCommand.platform);
558  IO.mapRequired("minos", LoadCommand.minos);
559  IO.mapRequired("sdk", LoadCommand.sdk);
560  IO.mapRequired("ntools", LoadCommand.ntools);
561 }
562 
563 } // end namespace yaml
564 
565 } // end namespace llvm
LoadCommandType
Definition: MachO.h:91
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:23
llvm::yaml::Hex64 addr
Definition: MachOYAML.h:32
std::vector< Object > Slices
Definition: MachOYAML.h:137
std::vector< MachOYAML::ExportEntry > Children
Definition: MachOYAML.h:96
std::vector< llvm::yaml::Hex8 > PayloadBytes
Definition: MachOYAML.h:61
bool isEmpty() const
Definition: DWARFYAML.cpp:18
llvm::yaml::Hex32 magic
Definition: MachOYAML.h:121
bool getAsUnsignedInteger(StringRef Str, unsigned Radix, unsigned long long &Result)
Helper functions for StringRef::getAsInteger.
Definition: StringRef.cpp:488
uint32_t reserved1
Definition: MachO.h:564
llvm::yaml::Hex64 offset
Definition: MachOYAML.h:128
std::vector< int64_t > SLEBExtraData
Definition: MachOYAML.h:84
char[16] char_16
Definition: MachOYAML.h:258
uint32_t reserved2
Definition: MachO.h:579
uint32_t size
Definition: MachO.h:558
DWARFYAML::Data DWARF
Definition: MachOYAML.h:117
llvm::yaml::Hex32 cputype
Definition: MachOYAML.h:46
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:51
std::vector< MachOYAML::RebaseOpcode > RebaseOpcodes
Definition: MachOYAML.h:100
LLVM_NODISCARD StringRef slice(size_t Start, size_t End) const
Return a reference to the substring from [Start, End).
Definition: StringRef.h:679
llvm::yaml::Hex32 cputype
Definition: MachOYAML.h:126
static const bool IsLittleEndianHost
Definition: Host.h:49
llvm::yaml::Hex32 cpusubtype
Definition: MachOYAML.h:127
std::vector< yaml::Hex64 > ExtraData
Definition: MachOYAML.h:77
LLVM_NODISCARD size_t size() const
size - Get the string size.
Definition: StringRef.h:130
LinkEditData LinkEdit
Definition: MachOYAML.h:116
std::vector< LoadCommand > LoadCommands
Definition: MachOYAML.h:114
uint32_t flags
Definition: MachO.h:563
llvm::yaml::Hex64 Address
Definition: MachOYAML.h:93
llvm::yaml::Hex64 Flags
Definition: MachOYAML.h:92
std::vector< MachOYAML::BindOpcode > WeakBindOpcodes
Definition: MachOYAML.h:102
uint32_t reserved1
Definition: MachO.h:578
MachOYAML::ExportEntry ExportTrie
Definition: MachOYAML.h:104
llvm::yaml::Hex32 offset
Definition: MachOYAML.h:34
std::vector< yaml::Hex64 > ULEBExtraData
Definition: MachOYAML.h:83
RebaseOpcode
Definition: MachO.h:231
MachO::RebaseOpcode Opcode
Definition: MachOYAML.h:75
std::vector< MachOYAML::BindOpcode > BindOpcodes
Definition: MachOYAML.h:101
uint8_t uuid[16]
Definition: MachO.h:775
MachO::BindOpcode Opcode
Definition: MachOYAML.h:81
std::vector< FatArch > FatArchs
Definition: MachOYAML.h:136
llvm::yaml::Hex32 reserved
Definition: MachOYAML.h:52
llvm::yaml::Hex64 Other
Definition: MachOYAML.h:94
This file declares classes for handling the YAML representation of Mach-O.
llvm::yaml::Hex32 reserved3
Definition: MachOYAML.h:41
struct fvmlib fvmlib
Definition: MachO.h:593
llvm::yaml::Hex32 cpusubtype
Definition: MachOYAML.h:47
llvm::yaml::Hex32 reloff
Definition: MachOYAML.h:36
char segname[16]
Definition: MachO.h:556
std::vector< NListEntry > NameList
Definition: MachOYAML.h:105
uint32_t reserved3
Definition: MachO.h:580
char sectname[16]
Definition: MachO.h:555
void mapLoadCommandData(IO &IO, MachOYAML::LoadCommand &LoadCommand)
Definition: MachOYAML.cpp:202
llvm::yaml::Hex32 reserved2
Definition: MachOYAML.h:40
llvm::yaml::Hex8 n_type
Definition: MachOYAML.h:68
LLVM_NODISCARD const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
Definition: StringRef.h:122
uint32_t addr
Definition: MachO.h:557
llvm::yaml::Hex32 flags
Definition: MachOYAML.h:38
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:48
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:45
std::vector< StringRef > StringTable
Definition: MachOYAML.h:106
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:48
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:58
uint32_t current_version
Definition: MachO.h:599
llvm::yaml::Hex32 reserved
Definition: MachOYAML.h:131
std::vector< MachOYAML::BindOpcode > LazyBindOpcodes
Definition: MachOYAML.h:103
uint32_t compatibility_version
Definition: MachO.h:600
uint32_t name
Definition: MachO.h:584
llvm::yaml::Hex32 reserved1
Definition: MachOYAML.h:39
llvm::yaml::Hex32 magic
Definition: MachOYAML.h:45
raw_ostream::uuid_t uuid_t
Definition: MachOYAML.h:268