[RISCV] Fix mgather -> riscv.masked.strided.load combine not extending indices (...
[llvm-project.git] / llvm / lib / ObjectYAML / MachOYAML.cpp
blob82b2eaecec9be9a51bc55d96e9795d823bacbb14
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.
11 //===----------------------------------------------------------------------===//
13 #include "llvm/ObjectYAML/MachOYAML.h"
14 #include "llvm/ADT/StringRef.h"
15 #include "llvm/BinaryFormat/MachO.h"
16 #include "llvm/Support/Format.h"
17 #include "llvm/Support/SystemZ/zOSSupport.h"
18 #include "llvm/Support/YAMLTraits.h"
19 #include "llvm/Support/raw_ostream.h"
20 #include "llvm/TargetParser/Host.h"
21 #include <cinttypes>
22 #include <cstdint>
23 #include <cstring>
25 namespace llvm {
27 MachOYAML::LoadCommand::~LoadCommand() = default;
29 bool MachOYAML::LinkEditData::isEmpty() const {
30 return 0 == RebaseOpcodes.size() + BindOpcodes.size() +
31 WeakBindOpcodes.size() + LazyBindOpcodes.size() +
32 ExportTrie.Children.size() + NameList.size() +
33 StringTable.size() + FunctionStarts.size() +
34 ChainedFixups.size() + DataInCode.size();
37 namespace yaml {
39 void ScalarTraits<char_16>::output(const char_16 &Val, void *,
40 raw_ostream &Out) {
41 auto Len = strnlen(&Val[0], 16);
42 Out << StringRef(&Val[0], Len);
45 StringRef ScalarTraits<char_16>::input(StringRef Scalar, void *, char_16 &Val) {
46 size_t CopySize = 16 >= Scalar.size() ? 16 : Scalar.size();
47 memcpy((void *)Val, Scalar.data(), CopySize);
49 if (Scalar.size() < 16) {
50 memset((void *)&Val[Scalar.size()], 0, 16 - Scalar.size());
53 return StringRef();
56 QuotingType ScalarTraits<char_16>::mustQuote(StringRef S) {
57 return needsQuotes(S);
60 void ScalarTraits<uuid_t>::output(const uuid_t &Val, void *, raw_ostream &Out) {
61 Out.write_uuid(Val);
64 StringRef ScalarTraits<uuid_t>::input(StringRef Scalar, void *, uuid_t &Val) {
65 size_t OutIdx = 0;
66 for (size_t Idx = 0; Idx < Scalar.size(); ++Idx) {
67 if (Scalar[Idx] == '-' || OutIdx >= 16)
68 continue;
69 unsigned long long TempInt;
70 if (getAsUnsignedInteger(Scalar.slice(Idx, Idx + 2), 16, TempInt))
71 return "invalid number";
72 if (TempInt > 0xFF)
73 return "out of range number";
74 Val[OutIdx] = static_cast<uint8_t>(TempInt);
75 ++Idx; // increment idx an extra time because we're consuming 2 chars
76 ++OutIdx;
78 return StringRef();
81 QuotingType ScalarTraits<uuid_t>::mustQuote(StringRef S) {
82 return needsQuotes(S);
85 void MappingTraits<MachOYAML::FileHeader>::mapping(
86 IO &IO, MachOYAML::FileHeader &FileHdr) {
87 IO.mapRequired("magic", FileHdr.magic);
88 IO.mapRequired("cputype", FileHdr.cputype);
89 IO.mapRequired("cpusubtype", FileHdr.cpusubtype);
90 IO.mapRequired("filetype", FileHdr.filetype);
91 IO.mapRequired("ncmds", FileHdr.ncmds);
92 IO.mapRequired("sizeofcmds", FileHdr.sizeofcmds);
93 IO.mapRequired("flags", FileHdr.flags);
94 if (FileHdr.magic == MachO::MH_MAGIC_64 ||
95 FileHdr.magic == MachO::MH_CIGAM_64)
96 IO.mapRequired("reserved", FileHdr.reserved);
99 void MappingTraits<MachOYAML::Object>::mapping(IO &IO,
100 MachOYAML::Object &Object) {
101 // If the context isn't already set, tag the document as !mach-o.
102 // For Fat files there will be a different tag so they can be differentiated.
103 if (!IO.getContext()) {
104 IO.setContext(&Object);
106 IO.mapTag("!mach-o", true);
107 IO.mapOptional("IsLittleEndian", Object.IsLittleEndian,
108 sys::IsLittleEndianHost);
109 Object.DWARF.IsLittleEndian = Object.IsLittleEndian;
111 IO.mapRequired("FileHeader", Object.Header);
112 Object.DWARF.Is64BitAddrSize = Object.Header.magic == MachO::MH_MAGIC_64 ||
113 Object.Header.magic == MachO::MH_CIGAM_64;
114 IO.mapOptional("LoadCommands", Object.LoadCommands);
116 if (Object.RawLinkEditSegment || !IO.outputting())
117 IO.mapOptional("__LINKEDIT", Object.RawLinkEditSegment);
118 if(!Object.LinkEdit.isEmpty() || !IO.outputting())
119 IO.mapOptional("LinkEditData", Object.LinkEdit);
121 if(!Object.DWARF.isEmpty() || !IO.outputting())
122 IO.mapOptional("DWARF", Object.DWARF);
124 if (IO.getContext() == &Object)
125 IO.setContext(nullptr);
128 void MappingTraits<MachOYAML::FatHeader>::mapping(
129 IO &IO, MachOYAML::FatHeader &FatHeader) {
130 IO.mapRequired("magic", FatHeader.magic);
131 IO.mapRequired("nfat_arch", FatHeader.nfat_arch);
134 void MappingTraits<MachOYAML::FatArch>::mapping(IO &IO,
135 MachOYAML::FatArch &FatArch) {
136 IO.mapRequired("cputype", FatArch.cputype);
137 IO.mapRequired("cpusubtype", FatArch.cpusubtype);
138 IO.mapRequired("offset", FatArch.offset);
139 IO.mapRequired("size", FatArch.size);
140 IO.mapRequired("align", FatArch.align);
141 IO.mapOptional("reserved", FatArch.reserved,
142 static_cast<llvm::yaml::Hex32>(0));
145 void MappingTraits<MachOYAML::UniversalBinary>::mapping(
146 IO &IO, MachOYAML::UniversalBinary &UniversalBinary) {
147 if (!IO.getContext()) {
148 IO.setContext(&UniversalBinary);
149 IO.mapTag("!fat-mach-o", true);
151 IO.mapRequired("FatHeader", UniversalBinary.Header);
152 IO.mapRequired("FatArchs", UniversalBinary.FatArchs);
153 IO.mapRequired("Slices", UniversalBinary.Slices);
155 if (IO.getContext() == &UniversalBinary)
156 IO.setContext(nullptr);
159 void MappingTraits<MachOYAML::LinkEditData>::mapping(
160 IO &IO, MachOYAML::LinkEditData &LinkEditData) {
161 IO.mapOptional("RebaseOpcodes", LinkEditData.RebaseOpcodes);
162 IO.mapOptional("BindOpcodes", LinkEditData.BindOpcodes);
163 IO.mapOptional("WeakBindOpcodes", LinkEditData.WeakBindOpcodes);
164 IO.mapOptional("LazyBindOpcodes", LinkEditData.LazyBindOpcodes);
165 if (!LinkEditData.ExportTrie.Children.empty() || !IO.outputting())
166 IO.mapOptional("ExportTrie", LinkEditData.ExportTrie);
167 IO.mapOptional("NameList", LinkEditData.NameList);
168 IO.mapOptional("StringTable", LinkEditData.StringTable);
169 IO.mapOptional("IndirectSymbols", LinkEditData.IndirectSymbols);
170 IO.mapOptional("FunctionStarts", LinkEditData.FunctionStarts);
171 IO.mapOptional("ChainedFixups", LinkEditData.ChainedFixups);
172 IO.mapOptional("DataInCode", LinkEditData.DataInCode);
175 void MappingTraits<MachOYAML::RebaseOpcode>::mapping(
176 IO &IO, MachOYAML::RebaseOpcode &RebaseOpcode) {
177 IO.mapRequired("Opcode", RebaseOpcode.Opcode);
178 IO.mapRequired("Imm", RebaseOpcode.Imm);
179 IO.mapOptional("ExtraData", RebaseOpcode.ExtraData);
182 void MappingTraits<MachOYAML::BindOpcode>::mapping(
183 IO &IO, MachOYAML::BindOpcode &BindOpcode) {
184 IO.mapRequired("Opcode", BindOpcode.Opcode);
185 IO.mapRequired("Imm", BindOpcode.Imm);
186 IO.mapOptional("ULEBExtraData", BindOpcode.ULEBExtraData);
187 IO.mapOptional("SLEBExtraData", BindOpcode.SLEBExtraData);
188 IO.mapOptional("Symbol", BindOpcode.Symbol);
191 void MappingTraits<MachOYAML::ExportEntry>::mapping(
192 IO &IO, MachOYAML::ExportEntry &ExportEntry) {
193 IO.mapRequired("TerminalSize", ExportEntry.TerminalSize);
194 IO.mapOptional("NodeOffset", ExportEntry.NodeOffset);
195 IO.mapOptional("Name", ExportEntry.Name);
196 IO.mapOptional("Flags", ExportEntry.Flags);
197 IO.mapOptional("Address", ExportEntry.Address);
198 IO.mapOptional("Other", ExportEntry.Other);
199 IO.mapOptional("ImportName", ExportEntry.ImportName);
200 IO.mapOptional("Children", ExportEntry.Children);
203 void MappingTraits<MachOYAML::NListEntry>::mapping(
204 IO &IO, MachOYAML::NListEntry &NListEntry) {
205 IO.mapRequired("n_strx", NListEntry.n_strx);
206 IO.mapRequired("n_type", NListEntry.n_type);
207 IO.mapRequired("n_sect", NListEntry.n_sect);
208 IO.mapRequired("n_desc", NListEntry.n_desc);
209 IO.mapRequired("n_value", NListEntry.n_value);
212 void MappingTraits<MachOYAML::DataInCodeEntry>::mapping(
213 IO &IO, MachOYAML::DataInCodeEntry &DataInCodeEntry) {
214 IO.mapRequired("Offset", DataInCodeEntry.Offset);
215 IO.mapRequired("Length", DataInCodeEntry.Length);
216 IO.mapRequired("Kind", DataInCodeEntry.Kind);
219 template <typename StructType>
220 void mapLoadCommandData(IO &IO, MachOYAML::LoadCommand &LoadCommand) {}
222 template <>
223 void mapLoadCommandData<MachO::segment_command>(
224 IO &IO, MachOYAML::LoadCommand &LoadCommand) {
225 IO.mapOptional("Sections", LoadCommand.Sections);
228 template <>
229 void mapLoadCommandData<MachO::segment_command_64>(
230 IO &IO, MachOYAML::LoadCommand &LoadCommand) {
231 IO.mapOptional("Sections", LoadCommand.Sections);
234 template <>
235 void mapLoadCommandData<MachO::dylib_command>(
236 IO &IO, MachOYAML::LoadCommand &LoadCommand) {
237 IO.mapOptional("Content", LoadCommand.Content);
240 template <>
241 void mapLoadCommandData<MachO::rpath_command>(
242 IO &IO, MachOYAML::LoadCommand &LoadCommand) {
243 IO.mapOptional("Content", LoadCommand.Content);
246 template <>
247 void mapLoadCommandData<MachO::dylinker_command>(
248 IO &IO, MachOYAML::LoadCommand &LoadCommand) {
249 IO.mapOptional("Content", LoadCommand.Content);
252 template <>
253 void mapLoadCommandData<MachO::sub_framework_command>(
254 IO &IO, MachOYAML::LoadCommand &LoadCommand) {
255 IO.mapOptional("Content", LoadCommand.Content);
258 template <>
259 void mapLoadCommandData<MachO::sub_umbrella_command>(
260 IO &IO, MachOYAML::LoadCommand &LoadCommand) {
261 IO.mapOptional("Content", LoadCommand.Content);
264 template <>
265 void mapLoadCommandData<MachO::sub_client_command>(
266 IO &IO, MachOYAML::LoadCommand &LoadCommand) {
267 IO.mapOptional("Content", LoadCommand.Content);
270 template <>
271 void mapLoadCommandData<MachO::sub_library_command>(
272 IO &IO, MachOYAML::LoadCommand &LoadCommand) {
273 IO.mapOptional("Content", LoadCommand.Content);
276 template <>
277 void mapLoadCommandData<MachO::build_version_command>(
278 IO &IO, MachOYAML::LoadCommand &LoadCommand) {
279 IO.mapOptional("Tools", LoadCommand.Tools);
282 void MappingTraits<MachOYAML::LoadCommand>::mapping(
283 IO &IO, MachOYAML::LoadCommand &LoadCommand) {
284 MachO::LoadCommandType TempCmd = static_cast<MachO::LoadCommandType>(
285 LoadCommand.Data.load_command_data.cmd);
286 IO.mapRequired("cmd", TempCmd);
287 LoadCommand.Data.load_command_data.cmd = TempCmd;
288 IO.mapRequired("cmdsize", LoadCommand.Data.load_command_data.cmdsize);
290 #define HANDLE_LOAD_COMMAND(LCName, LCValue, LCStruct) \
291 case MachO::LCName: \
292 MappingTraits<MachO::LCStruct>::mapping(IO, \
293 LoadCommand.Data.LCStruct##_data); \
294 mapLoadCommandData<MachO::LCStruct>(IO, LoadCommand); \
295 break;
297 switch (LoadCommand.Data.load_command_data.cmd) {
298 #include "llvm/BinaryFormat/MachO.def"
300 IO.mapOptional("PayloadBytes", LoadCommand.PayloadBytes);
301 IO.mapOptional("ZeroPadBytes", LoadCommand.ZeroPadBytes, (uint64_t)0ull);
304 void MappingTraits<MachO::dyld_info_command>::mapping(
305 IO &IO, MachO::dyld_info_command &LoadCommand) {
306 IO.mapRequired("rebase_off", LoadCommand.rebase_off);
307 IO.mapRequired("rebase_size", LoadCommand.rebase_size);
308 IO.mapRequired("bind_off", LoadCommand.bind_off);
309 IO.mapRequired("bind_size", LoadCommand.bind_size);
310 IO.mapRequired("weak_bind_off", LoadCommand.weak_bind_off);
311 IO.mapRequired("weak_bind_size", LoadCommand.weak_bind_size);
312 IO.mapRequired("lazy_bind_off", LoadCommand.lazy_bind_off);
313 IO.mapRequired("lazy_bind_size", LoadCommand.lazy_bind_size);
314 IO.mapRequired("export_off", LoadCommand.export_off);
315 IO.mapRequired("export_size", LoadCommand.export_size);
318 void MappingTraits<MachOYAML::Relocation>::mapping(
319 IO &IO, MachOYAML::Relocation &Relocation) {
320 IO.mapRequired("address", Relocation.address);
321 IO.mapRequired("symbolnum", Relocation.symbolnum);
322 IO.mapRequired("pcrel", Relocation.is_pcrel);
323 IO.mapRequired("length", Relocation.length);
324 IO.mapRequired("extern", Relocation.is_extern);
325 IO.mapRequired("type", Relocation.type);
326 IO.mapRequired("scattered", Relocation.is_scattered);
327 IO.mapRequired("value", Relocation.value);
330 void MappingTraits<MachOYAML::Section>::mapping(IO &IO,
331 MachOYAML::Section &Section) {
332 IO.mapRequired("sectname", Section.sectname);
333 IO.mapRequired("segname", Section.segname);
334 IO.mapRequired("addr", Section.addr);
335 IO.mapRequired("size", Section.size);
336 IO.mapRequired("offset", Section.offset);
337 IO.mapRequired("align", Section.align);
338 IO.mapRequired("reloff", Section.reloff);
339 IO.mapRequired("nreloc", Section.nreloc);
340 IO.mapRequired("flags", Section.flags);
341 IO.mapRequired("reserved1", Section.reserved1);
342 IO.mapRequired("reserved2", Section.reserved2);
343 IO.mapOptional("reserved3", Section.reserved3);
344 IO.mapOptional("content", Section.content);
345 IO.mapOptional("relocations", Section.relocations);
348 std::string
349 MappingTraits<MachOYAML::Section>::validate(IO &IO,
350 MachOYAML::Section &Section) {
351 if (Section.content && Section.size < Section.content->binary_size())
352 return "Section size must be greater than or equal to the content size";
353 return "";
356 void MappingTraits<MachO::build_tool_version>::mapping(
357 IO &IO, MachO::build_tool_version &tool) {
358 IO.mapRequired("tool", tool.tool);
359 IO.mapRequired("version", tool.version);
362 void MappingTraits<MachO::dylib>::mapping(IO &IO, MachO::dylib &DylibStruct) {
363 IO.mapRequired("name", DylibStruct.name);
364 IO.mapRequired("timestamp", DylibStruct.timestamp);
365 IO.mapRequired("current_version", DylibStruct.current_version);
366 IO.mapRequired("compatibility_version", DylibStruct.compatibility_version);
369 void MappingTraits<MachO::dylib_command>::mapping(
370 IO &IO, MachO::dylib_command &LoadCommand) {
371 IO.mapRequired("dylib", LoadCommand.dylib);
374 void MappingTraits<MachO::dylinker_command>::mapping(
375 IO &IO, MachO::dylinker_command &LoadCommand) {
376 IO.mapRequired("name", LoadCommand.name);
379 void MappingTraits<MachO::dysymtab_command>::mapping(
380 IO &IO, MachO::dysymtab_command &LoadCommand) {
381 IO.mapRequired("ilocalsym", LoadCommand.ilocalsym);
382 IO.mapRequired("nlocalsym", LoadCommand.nlocalsym);
383 IO.mapRequired("iextdefsym", LoadCommand.iextdefsym);
384 IO.mapRequired("nextdefsym", LoadCommand.nextdefsym);
385 IO.mapRequired("iundefsym", LoadCommand.iundefsym);
386 IO.mapRequired("nundefsym", LoadCommand.nundefsym);
387 IO.mapRequired("tocoff", LoadCommand.tocoff);
388 IO.mapRequired("ntoc", LoadCommand.ntoc);
389 IO.mapRequired("modtaboff", LoadCommand.modtaboff);
390 IO.mapRequired("nmodtab", LoadCommand.nmodtab);
391 IO.mapRequired("extrefsymoff", LoadCommand.extrefsymoff);
392 IO.mapRequired("nextrefsyms", LoadCommand.nextrefsyms);
393 IO.mapRequired("indirectsymoff", LoadCommand.indirectsymoff);
394 IO.mapRequired("nindirectsyms", LoadCommand.nindirectsyms);
395 IO.mapRequired("extreloff", LoadCommand.extreloff);
396 IO.mapRequired("nextrel", LoadCommand.nextrel);
397 IO.mapRequired("locreloff", LoadCommand.locreloff);
398 IO.mapRequired("nlocrel", LoadCommand.nlocrel);
401 void MappingTraits<MachO::encryption_info_command>::mapping(
402 IO &IO, MachO::encryption_info_command &LoadCommand) {
403 IO.mapRequired("cryptoff", LoadCommand.cryptoff);
404 IO.mapRequired("cryptsize", LoadCommand.cryptsize);
405 IO.mapRequired("cryptid", LoadCommand.cryptid);
408 void MappingTraits<MachO::encryption_info_command_64>::mapping(
409 IO &IO, MachO::encryption_info_command_64 &LoadCommand) {
410 IO.mapRequired("cryptoff", LoadCommand.cryptoff);
411 IO.mapRequired("cryptsize", LoadCommand.cryptsize);
412 IO.mapRequired("cryptid", LoadCommand.cryptid);
413 IO.mapRequired("pad", LoadCommand.pad);
416 void MappingTraits<MachO::entry_point_command>::mapping(
417 IO &IO, MachO::entry_point_command &LoadCommand) {
418 IO.mapRequired("entryoff", LoadCommand.entryoff);
419 IO.mapRequired("stacksize", LoadCommand.stacksize);
422 void MappingTraits<MachO::fvmfile_command>::mapping(
423 IO &IO, MachO::fvmfile_command &LoadCommand) {
424 IO.mapRequired("name", LoadCommand.name);
425 IO.mapRequired("header_addr", LoadCommand.header_addr);
428 void MappingTraits<MachO::fvmlib>::mapping(IO &IO, MachO::fvmlib &FVMLib) {
429 IO.mapRequired("name", FVMLib.name);
430 IO.mapRequired("minor_version", FVMLib.minor_version);
431 IO.mapRequired("header_addr", FVMLib.header_addr);
434 void MappingTraits<MachO::fvmlib_command>::mapping(
435 IO &IO, MachO::fvmlib_command &LoadCommand) {
436 IO.mapRequired("fvmlib", LoadCommand.fvmlib);
439 void MappingTraits<MachO::ident_command>::mapping(
440 IO &IO, MachO::ident_command &LoadCommand) {}
442 void MappingTraits<MachO::linkedit_data_command>::mapping(
443 IO &IO, MachO::linkedit_data_command &LoadCommand) {
444 IO.mapRequired("dataoff", LoadCommand.dataoff);
445 IO.mapRequired("datasize", LoadCommand.datasize);
448 void MappingTraits<MachO::linker_option_command>::mapping(
449 IO &IO, MachO::linker_option_command &LoadCommand) {
450 IO.mapRequired("count", LoadCommand.count);
453 void MappingTraits<MachO::prebind_cksum_command>::mapping(
454 IO &IO, MachO::prebind_cksum_command &LoadCommand) {
455 IO.mapRequired("cksum", LoadCommand.cksum);
458 void MappingTraits<MachO::load_command>::mapping(
459 IO &IO, MachO::load_command &LoadCommand) {}
461 void MappingTraits<MachO::prebound_dylib_command>::mapping(
462 IO &IO, MachO::prebound_dylib_command &LoadCommand) {
463 IO.mapRequired("name", LoadCommand.name);
464 IO.mapRequired("nmodules", LoadCommand.nmodules);
465 IO.mapRequired("linked_modules", LoadCommand.linked_modules);
468 void MappingTraits<MachO::routines_command>::mapping(
469 IO &IO, MachO::routines_command &LoadCommand) {
470 IO.mapRequired("init_address", LoadCommand.init_address);
471 IO.mapRequired("init_module", LoadCommand.init_module);
472 IO.mapRequired("reserved1", LoadCommand.reserved1);
473 IO.mapRequired("reserved2", LoadCommand.reserved2);
474 IO.mapRequired("reserved3", LoadCommand.reserved3);
475 IO.mapRequired("reserved4", LoadCommand.reserved4);
476 IO.mapRequired("reserved5", LoadCommand.reserved5);
477 IO.mapRequired("reserved6", LoadCommand.reserved6);
480 void MappingTraits<MachO::routines_command_64>::mapping(
481 IO &IO, MachO::routines_command_64 &LoadCommand) {
482 IO.mapRequired("init_address", LoadCommand.init_address);
483 IO.mapRequired("init_module", LoadCommand.init_module);
484 IO.mapRequired("reserved1", LoadCommand.reserved1);
485 IO.mapRequired("reserved2", LoadCommand.reserved2);
486 IO.mapRequired("reserved3", LoadCommand.reserved3);
487 IO.mapRequired("reserved4", LoadCommand.reserved4);
488 IO.mapRequired("reserved5", LoadCommand.reserved5);
489 IO.mapRequired("reserved6", LoadCommand.reserved6);
492 void MappingTraits<MachO::rpath_command>::mapping(
493 IO &IO, MachO::rpath_command &LoadCommand) {
494 IO.mapRequired("path", LoadCommand.path);
497 void MappingTraits<MachO::section>::mapping(IO &IO, MachO::section &Section) {
498 IO.mapRequired("sectname", Section.sectname);
499 IO.mapRequired("segname", Section.segname);
500 IO.mapRequired("addr", Section.addr);
501 IO.mapRequired("size", Section.size);
502 IO.mapRequired("offset", Section.offset);
503 IO.mapRequired("align", Section.align);
504 IO.mapRequired("reloff", Section.reloff);
505 IO.mapRequired("nreloc", Section.nreloc);
506 IO.mapRequired("flags", Section.flags);
507 IO.mapRequired("reserved1", Section.reserved1);
508 IO.mapRequired("reserved2", Section.reserved2);
511 void MappingTraits<MachO::section_64>::mapping(IO &IO,
512 MachO::section_64 &Section) {
513 IO.mapRequired("sectname", Section.sectname);
514 IO.mapRequired("segname", Section.segname);
515 IO.mapRequired("addr", Section.addr);
516 IO.mapRequired("size", Section.size);
517 IO.mapRequired("offset", Section.offset);
518 IO.mapRequired("align", Section.align);
519 IO.mapRequired("reloff", Section.reloff);
520 IO.mapRequired("nreloc", Section.nreloc);
521 IO.mapRequired("flags", Section.flags);
522 IO.mapRequired("reserved1", Section.reserved1);
523 IO.mapRequired("reserved2", Section.reserved2);
524 IO.mapRequired("reserved3", Section.reserved3);
527 void MappingTraits<MachO::segment_command>::mapping(
528 IO &IO, MachO::segment_command &LoadCommand) {
529 IO.mapRequired("segname", LoadCommand.segname);
530 IO.mapRequired("vmaddr", LoadCommand.vmaddr);
531 IO.mapRequired("vmsize", LoadCommand.vmsize);
532 IO.mapRequired("fileoff", LoadCommand.fileoff);
533 IO.mapRequired("filesize", LoadCommand.filesize);
534 IO.mapRequired("maxprot", LoadCommand.maxprot);
535 IO.mapRequired("initprot", LoadCommand.initprot);
536 IO.mapRequired("nsects", LoadCommand.nsects);
537 IO.mapRequired("flags", LoadCommand.flags);
540 void MappingTraits<MachO::segment_command_64>::mapping(
541 IO &IO, MachO::segment_command_64 &LoadCommand) {
542 IO.mapRequired("segname", LoadCommand.segname);
543 IO.mapRequired("vmaddr", LoadCommand.vmaddr);
544 IO.mapRequired("vmsize", LoadCommand.vmsize);
545 IO.mapRequired("fileoff", LoadCommand.fileoff);
546 IO.mapRequired("filesize", LoadCommand.filesize);
547 IO.mapRequired("maxprot", LoadCommand.maxprot);
548 IO.mapRequired("initprot", LoadCommand.initprot);
549 IO.mapRequired("nsects", LoadCommand.nsects);
550 IO.mapRequired("flags", LoadCommand.flags);
553 void MappingTraits<MachO::source_version_command>::mapping(
554 IO &IO, MachO::source_version_command &LoadCommand) {
555 IO.mapRequired("version", LoadCommand.version);
558 void MappingTraits<MachO::sub_client_command>::mapping(
559 IO &IO, MachO::sub_client_command &LoadCommand) {
560 IO.mapRequired("client", LoadCommand.client);
563 void MappingTraits<MachO::sub_framework_command>::mapping(
564 IO &IO, MachO::sub_framework_command &LoadCommand) {
565 IO.mapRequired("umbrella", LoadCommand.umbrella);
568 void MappingTraits<MachO::sub_library_command>::mapping(
569 IO &IO, MachO::sub_library_command &LoadCommand) {
570 IO.mapRequired("sub_library", LoadCommand.sub_library);
573 void MappingTraits<MachO::sub_umbrella_command>::mapping(
574 IO &IO, MachO::sub_umbrella_command &LoadCommand) {
575 IO.mapRequired("sub_umbrella", LoadCommand.sub_umbrella);
578 void MappingTraits<MachO::symseg_command>::mapping(
579 IO &IO, MachO::symseg_command &LoadCommand) {
580 IO.mapRequired("offset", LoadCommand.offset);
581 IO.mapRequired("size", LoadCommand.size);
584 void MappingTraits<MachO::symtab_command>::mapping(
585 IO &IO, MachO::symtab_command &LoadCommand) {
586 IO.mapRequired("symoff", LoadCommand.symoff);
587 IO.mapRequired("nsyms", LoadCommand.nsyms);
588 IO.mapRequired("stroff", LoadCommand.stroff);
589 IO.mapRequired("strsize", LoadCommand.strsize);
592 void MappingTraits<MachO::thread_command>::mapping(
593 IO &IO, MachO::thread_command &LoadCommand) {}
595 void MappingTraits<MachO::twolevel_hints_command>::mapping(
596 IO &IO, MachO::twolevel_hints_command &LoadCommand) {
597 IO.mapRequired("offset", LoadCommand.offset);
598 IO.mapRequired("nhints", LoadCommand.nhints);
601 void MappingTraits<MachO::uuid_command>::mapping(
602 IO &IO, MachO::uuid_command &LoadCommand) {
603 IO.mapRequired("uuid", LoadCommand.uuid);
606 void MappingTraits<MachO::version_min_command>::mapping(
607 IO &IO, MachO::version_min_command &LoadCommand) {
608 IO.mapRequired("version", LoadCommand.version);
609 IO.mapRequired("sdk", LoadCommand.sdk);
612 void MappingTraits<MachO::note_command>::mapping(
613 IO &IO, MachO::note_command &LoadCommand) {
614 IO.mapRequired("data_owner", LoadCommand.data_owner);
615 IO.mapRequired("offset", LoadCommand.offset);
616 IO.mapRequired("size", LoadCommand.size);
619 void MappingTraits<MachO::build_version_command>::mapping(
620 IO &IO, MachO::build_version_command &LoadCommand) {
621 IO.mapRequired("platform", LoadCommand.platform);
622 IO.mapRequired("minos", LoadCommand.minos);
623 IO.mapRequired("sdk", LoadCommand.sdk);
624 IO.mapRequired("ntools", LoadCommand.ntools);
627 void MappingTraits<MachO::fileset_entry_command>::mapping(
628 IO &IO, MachO::fileset_entry_command &LoadCommand) {
629 IO.mapRequired("vmaddr", LoadCommand.vmaddr);
630 IO.mapRequired("fileoff", LoadCommand.fileoff);
631 IO.mapRequired("id", LoadCommand.entry_id.offset);
632 IO.mapOptional("reserved", LoadCommand.reserved);
635 } // end namespace yaml
637 } // end namespace llvm