LLVM  15.0.0git
MachO.h
Go to the documentation of this file.
1 //===- MachO.h - MachO object file implementation ---------------*- C++ -*-===//
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 declares the MachOObjectFile class, which implement the ObjectFile
10 // interface for MachO files.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_OBJECT_MACHO_H
15 #define LLVM_OBJECT_MACHO_H
16 
17 #include "llvm/ADT/ArrayRef.h"
18 #include "llvm/ADT/SmallString.h"
19 #include "llvm/ADT/SmallVector.h"
20 #include "llvm/ADT/StringExtras.h"
21 #include "llvm/ADT/StringRef.h"
22 #include "llvm/ADT/Triple.h"
27 #include "llvm/Object/Binary.h"
28 #include "llvm/Object/ObjectFile.h"
30 #include "llvm/Support/Error.h"
31 #include "llvm/Support/Format.h"
34 #include <cstdint>
35 #include <memory>
36 #include <string>
37 #include <system_error>
38 
39 namespace llvm {
40 namespace object {
41 
42 /// DiceRef - This is a value type class that represents a single
43 /// data in code entry in the table in a Mach-O object file.
44 class DiceRef {
45  DataRefImpl DicePimpl;
46  const ObjectFile *OwningObject = nullptr;
47 
48 public:
49  DiceRef() = default;
50  DiceRef(DataRefImpl DiceP, const ObjectFile *Owner);
51 
52  bool operator==(const DiceRef &Other) const;
53  bool operator<(const DiceRef &Other) const;
54 
55  void moveNext();
56 
57  std::error_code getOffset(uint32_t &Result) const;
58  std::error_code getLength(uint16_t &Result) const;
59  std::error_code getKind(uint16_t &Result) const;
60 
62  const ObjectFile *getObjectFile() const;
63 };
65 
66 /// ExportEntry encapsulates the current-state-of-the-walk used when doing a
67 /// non-recursive walk of the trie data structure. This allows you to iterate
68 /// across all exported symbols using:
69 /// Error Err = Error::success();
70 /// for (const llvm::object::ExportEntry &AnExport : Obj->exports(&Err)) {
71 /// }
72 /// if (Err) { report error ...
73 class ExportEntry {
74 public:
75  ExportEntry(Error *Err, const MachOObjectFile *O, ArrayRef<uint8_t> Trie);
76 
77  StringRef name() const;
78  uint64_t flags() const;
79  uint64_t address() const;
80  uint64_t other() const;
81  StringRef otherName() const;
82  uint32_t nodeOffset() const;
83 
84  bool operator==(const ExportEntry &) const;
85 
86  void moveNext();
87 
88 private:
89  friend class MachOObjectFile;
90 
91  void moveToFirst();
92  void moveToEnd();
93  uint64_t readULEB128(const uint8_t *&p, const char **error);
94  void pushDownUntilBottom();
95  void pushNode(uint64_t Offset);
96 
97  // Represents a node in the mach-o exports trie.
98  struct NodeState {
99  NodeState(const uint8_t *Ptr);
100 
101  const uint8_t *Start;
102  const uint8_t *Current;
103  uint64_t Flags = 0;
104  uint64_t Address = 0;
105  uint64_t Other = 0;
106  const char *ImportName = nullptr;
107  unsigned ChildCount = 0;
108  unsigned NextChildIndex = 0;
109  unsigned ParentStringLength = 0;
110  bool IsExportNode = false;
111  };
113  using node_iterator = NodeList::const_iterator;
114 
115  Error *E;
116  const MachOObjectFile *O;
117  ArrayRef<uint8_t> Trie;
118  SmallString<256> CumulativeString;
119  NodeList Stack;
120  bool Done = false;
121 
122  iterator_range<node_iterator> nodes() const {
123  return make_range(Stack.begin(), Stack.end());
124  }
125 };
127 
128 // Segment info so SegIndex/SegOffset pairs in a Mach-O Bind or Rebase entry
129 // can be checked and translated. Only the SegIndex/SegOffset pairs from
130 // checked entries are to be used with the segmentName(), sectionName() and
131 // address() methods below.
133 public:
135 
136  // Used to check a Mach-O Bind or Rebase entry for errors when iterating.
137  const char* checkSegAndOffsets(int32_t SegIndex, uint64_t SegOffset,
138  uint8_t PointerSize, uint32_t Count=1,
139  uint32_t Skip=0);
140  // Used with valid SegIndex/SegOffset values from checked entries.
141  StringRef segmentName(int32_t SegIndex);
142  StringRef sectionName(int32_t SegIndex, uint64_t SegOffset);
143  uint64_t address(uint32_t SegIndex, uint64_t SegOffset);
144 
145 private:
146  struct SectionInfo {
147  uint64_t Address;
148  uint64_t Size;
150  StringRef SegmentName;
151  uint64_t OffsetInSegment;
152  uint64_t SegmentStartAddress;
153  int32_t SegmentIndex;
154  };
155  const SectionInfo &findSection(int32_t SegIndex, uint64_t SegOffset);
156 
158  int32_t MaxSegIndex;
159 };
160 
161 /// MachORebaseEntry encapsulates the current state in the decompression of
162 /// rebasing opcodes. This allows you to iterate through the compressed table of
163 /// rebasing using:
164 /// Error Err = Error::success();
165 /// for (const llvm::object::MachORebaseEntry &Entry : Obj->rebaseTable(&Err)) {
166 /// }
167 /// if (Err) { report error ...
169 public:
170  MachORebaseEntry(Error *Err, const MachOObjectFile *O,
171  ArrayRef<uint8_t> opcodes, bool is64Bit);
172 
173  int32_t segmentIndex() const;
174  uint64_t segmentOffset() const;
175  StringRef typeName() const;
176  StringRef segmentName() const;
177  StringRef sectionName() const;
178  uint64_t address() const;
179 
180  bool operator==(const MachORebaseEntry &) const;
181 
182  void moveNext();
183 
184 private:
185  friend class MachOObjectFile;
186 
187  void moveToFirst();
188  void moveToEnd();
189  uint64_t readULEB128(const char **error);
190 
191  Error *E;
192  const MachOObjectFile *O;
193  ArrayRef<uint8_t> Opcodes;
194  const uint8_t *Ptr;
196  int32_t SegmentIndex = -1;
197  uint64_t RemainingLoopCount = 0;
198  uint64_t AdvanceAmount = 0;
199  uint8_t RebaseType = 0;
200  uint8_t PointerSize;
201  bool Done = false;
202 };
204 
205 /// MachOBindEntry encapsulates the current state in the decompression of
206 /// binding opcodes. This allows you to iterate through the compressed table of
207 /// bindings using:
208 /// Error Err = Error::success();
209 /// for (const llvm::object::MachOBindEntry &Entry : Obj->bindTable(&Err)) {
210 /// }
211 /// if (Err) { report error ...
213 public:
214  enum class Kind { Regular, Lazy, Weak };
215 
216  MachOBindEntry(Error *Err, const MachOObjectFile *O,
218 
219  int32_t segmentIndex() const;
220  uint64_t segmentOffset() const;
221  StringRef typeName() const;
222  StringRef symbolName() const;
223  uint32_t flags() const;
224  int64_t addend() const;
225  int ordinal() const;
226 
227  StringRef segmentName() const;
228  StringRef sectionName() const;
229  uint64_t address() const;
230 
231  bool operator==(const MachOBindEntry &) const;
232 
233  void moveNext();
234 
235 private:
236  friend class MachOObjectFile;
237 
238  void moveToFirst();
239  void moveToEnd();
240  uint64_t readULEB128(const char **error);
241  int64_t readSLEB128(const char **error);
242 
243  Error *E;
244  const MachOObjectFile *O;
245  ArrayRef<uint8_t> Opcodes;
246  const uint8_t *Ptr;
248  int32_t SegmentIndex = -1;
250  bool LibraryOrdinalSet = false;
251  int Ordinal = 0;
252  uint32_t Flags = 0;
253  int64_t Addend = 0;
254  uint64_t RemainingLoopCount = 0;
255  uint64_t AdvanceAmount = 0;
256  uint8_t BindType = 0;
257  uint8_t PointerSize;
258  Kind TableKind;
259  bool Done = false;
260 };
262 
263 /// ChainedFixupTarget holds all the information about an external symbol
264 /// necessary to bind this binary to that symbol. These values are referenced
265 /// indirectly by chained fixup binds. This structure captures values from all
266 /// import and symbol formats.
267 ///
268 /// Be aware there are two notions of weak here:
269 /// WeakImport == true
270 /// The associated bind may be set to 0 if this symbol is missing from its
271 /// parent library. This is called a "weak import."
272 /// LibOrdinal == BIND_SPECIAL_DYLIB_WEAK_LOOKUP
273 /// This symbol may be coalesced with other libraries vending the same
274 /// symbol. E.g., C++'s "operator new". This is called a "weak bind."
276 public:
277  ChainedFixupTarget(int LibOrdinal, StringRef Symbol, uint64_t Addend,
278  bool WeakImport)
279  : LibOrdinal(LibOrdinal), SymbolName(Symbol), Addend(Addend),
280  WeakImport(WeakImport) {}
281 
282  int libOrdinal() { return LibOrdinal; }
283  StringRef symbolName() { return SymbolName; }
284  uint64_t addend() { return Addend; }
285  bool weakImport() { return WeakImport; }
286  bool weakBind() {
287  return LibOrdinal == MachO::BIND_SPECIAL_DYLIB_WEAK_LOOKUP;
288  }
289 
290 private:
291  int LibOrdinal;
292  StringRef SymbolName;
293  uint64_t Addend;
294  bool WeakImport;
295 };
296 
297 /// MachOAbstractFixupEntry is an abstract class representing a fixup in a
298 /// MH_DYLDLINK file. Fixups generally represent rebases and binds. Binds also
299 /// subdivide into additional subtypes (weak, lazy, reexport).
300 ///
301 /// The two concrete subclasses of MachOAbstractFixupEntry are:
302 ///
303 /// MachORebaseBindEntry - for dyld opcode-based tables, including threaded-
304 /// rebase, where rebases are mixed in with other
305 /// bind opcodes.
306 /// MachOChainedFixupEntry - for pointer chains embedded in data pages.
308 public:
310 
311  int32_t segmentIndex() const;
312  uint64_t segmentOffset() const;
313  uint64_t segmentAddress() const;
314  StringRef segmentName() const;
315  StringRef sectionName() const;
316  StringRef typeName() const;
317  StringRef symbolName() const;
318  uint32_t flags() const;
319  int64_t addend() const;
320  int ordinal() const;
321 
322  /// \return the location of this fixup as a VM Address. For the VM
323  /// Address this fixup is pointing to, use pointerValue().
324  uint64_t address() const;
325 
326  /// \return the VM Address pointed to by this fixup. Use
327  /// pointerValue() to compare against other VM Addresses, such as
328  /// section addresses or segment vmaddrs.
329  uint64_t pointerValue() const { return PointerValue; }
330 
331  /// \return the raw "on-disk" representation of the fixup. For
332  /// Threaded rebases and Chained pointers these values are generally
333  /// encoded into various different pointer formats. This value is
334  /// exposed in API for tools that want to display and annotate the
335  /// raw bits.
336  uint64_t rawValue() const { return RawValue; }
337 
338  void moveNext();
339 
340 protected:
344  int32_t SegmentIndex = -1;
346  int32_t Ordinal = 0;
348  int64_t Addend = 0;
351  bool Done = false;
352 
353  void moveToFirst();
354  void moveToEnd();
355 
356  /// \return the vm address of the start of __TEXT segment.
357  uint64_t textAddress() const { return TextAddress; }
358 
359 private:
360  uint64_t TextAddress;
361 };
362 
364 public:
365  enum class FixupKind { All, Bind, WeakBind, Rebase };
366 
367  MachOChainedFixupEntry(Error *Err, const MachOObjectFile *O, bool Parse);
368 
369  bool operator==(const MachOChainedFixupEntry &) const;
370 
371  void moveNext();
372  void moveToFirst();
373  void moveToEnd();
374 
375 private:
376  std::vector<ChainedFixupTarget> FixupTargets;
377  uint32_t FixupIndex = 0;
378 };
380 
381 class MachOObjectFile : public ObjectFile {
382 public:
384  const char *Ptr; // Where in memory the load command is.
385  MachO::load_command C; // The command itself.
386  };
389 
391  create(MemoryBufferRef Object, bool IsLittleEndian, bool Is64Bits,
392  uint32_t UniversalCputype = 0, uint32_t UniversalIndex = 0);
393 
394  static bool isMachOPairedReloc(uint64_t RelocType, uint64_t Arch);
395 
396  void moveSymbolNext(DataRefImpl &Symb) const override;
397 
398  uint64_t getNValue(DataRefImpl Sym) const;
399  Expected<StringRef> getSymbolName(DataRefImpl Symb) const override;
400 
401  // MachO specific.
402  Error checkSymbolTable() const;
403 
404  std::error_code getIndirectName(DataRefImpl Symb, StringRef &Res) const;
405  unsigned getSectionType(SectionRef Sec) const;
406 
407  Expected<uint64_t> getSymbolAddress(DataRefImpl Symb) const override;
408  uint32_t getSymbolAlignment(DataRefImpl Symb) const override;
409  uint64_t getCommonSymbolSizeImpl(DataRefImpl Symb) const override;
411  Expected<uint32_t> getSymbolFlags(DataRefImpl Symb) const override;
413  unsigned getSymbolSectionID(SymbolRef Symb) const;
414  unsigned getSectionID(SectionRef Sec) const;
415 
416  void moveSectionNext(DataRefImpl &Sec) const override;
417  Expected<StringRef> getSectionName(DataRefImpl Sec) const override;
418  uint64_t getSectionAddress(DataRefImpl Sec) const override;
419  uint64_t getSectionIndex(DataRefImpl Sec) const override;
420  uint64_t getSectionSize(DataRefImpl Sec) const override;
423  getSectionContents(DataRefImpl Sec) const override;
424  uint64_t getSectionAlignment(DataRefImpl Sec) const override;
425  Expected<SectionRef> getSection(unsigned SectionIndex) const;
427  bool isSectionCompressed(DataRefImpl Sec) const override;
428  bool isSectionText(DataRefImpl Sec) const override;
429  bool isSectionData(DataRefImpl Sec) const override;
430  bool isSectionBSS(DataRefImpl Sec) const override;
431  bool isSectionVirtual(DataRefImpl Sec) const override;
432  bool isSectionBitcode(DataRefImpl Sec) const override;
433  bool isDebugSection(DataRefImpl Sec) const override;
434 
435  /// Return the raw contents of an entire segment.
437 
438  /// When dsymutil generates the companion file, it strips all unnecessary
439  /// sections (e.g. everything in the _TEXT segment) by omitting their body
440  /// and setting the offset in their corresponding load command to zero.
441  ///
442  /// While the load command itself is valid, reading the section corresponds
443  /// to reading the number of bytes specified in the load command, starting
444  /// from offset 0 (i.e. the Mach-O header at the beginning of the file).
445  bool isSectionStripped(DataRefImpl Sec) const override;
446 
448  relocation_iterator section_rel_end(DataRefImpl Sec) const override;
449 
453  return make_range(extrel_begin(), extrel_end());
454  }
455 
458 
459  void moveRelocationNext(DataRefImpl &Rel) const override;
460  uint64_t getRelocationOffset(DataRefImpl Rel) const override;
461  symbol_iterator getRelocationSymbol(DataRefImpl Rel) const override;
463  uint64_t getRelocationType(DataRefImpl Rel) const override;
465  SmallVectorImpl<char> &Result) const override;
466  uint8_t getRelocationLength(DataRefImpl Rel) const;
467 
468  // MachO specific.
469  std::error_code getLibraryShortNameByIndex(unsigned Index, StringRef &) const;
470  uint32_t getLibraryCount() const;
471 
473 
474  // TODO: Would be useful to have an iterator based version
475  // of the load command interface too.
476 
477  basic_symbol_iterator symbol_begin() const override;
478  basic_symbol_iterator symbol_end() const override;
479 
480  // MachO specific.
481  symbol_iterator getSymbolByIndex(unsigned Index) const;
482  uint64_t getSymbolIndex(DataRefImpl Symb) const;
483 
484  section_iterator section_begin() const override;
485  section_iterator section_end() const override;
486 
487  uint8_t getBytesInAddress() const override;
488 
489  StringRef getFileFormatName() const override;
490  Triple::ArchType getArch() const override;
491  SubtargetFeatures getFeatures() const override { return SubtargetFeatures(); }
492  Triple getArchTriple(const char **McpuDefault = nullptr) const;
493 
495  relocation_iterator section_rel_end(unsigned Index) const;
496 
497  dice_iterator begin_dices() const;
498  dice_iterator end_dices() const;
499 
503 
504  /// For use iterating over all exported symbols.
506 
507  /// For use examining a trie not in a MachOObjectFile.
509  ArrayRef<uint8_t> Trie,
510  const MachOObjectFile *O =
511  nullptr);
512 
513  /// For use iterating over all rebase table entries.
515 
516  /// For use examining rebase opcodes in a MachOObjectFile.
519  ArrayRef<uint8_t> Opcodes,
520  bool is64);
521 
522  /// For use iterating over all bind table entries.
524 
525  /// For iterating over all chained fixups.
527 
528  /// For use iterating over all lazy bind table entries.
530 
531  /// For use iterating over all weak bind table entries.
533 
534  /// For use examining bind opcodes in a MachOObjectFile.
537  ArrayRef<uint8_t> Opcodes,
538  bool is64,
540 
541  // Given a SegIndex, SegOffset, and PointerSize, verify a valid section exists
542  // that fully contains a pointer at that location. Multiple fixups in a bind
543  // (such as with the BIND_OPCODE_DO_BIND_ULEB_TIMES_SKIPPING_ULEB opcode) can
544  // be tested via the Count and Skip parameters.
545  //
546  // This is used by MachOBindEntry::moveNext() to validate a MachOBindEntry.
547  const char *BindEntryCheckSegAndOffsets(int32_t SegIndex, uint64_t SegOffset,
548  uint8_t PointerSize, uint32_t Count=1,
549  uint32_t Skip=0) const {
550  return BindRebaseSectionTable->checkSegAndOffsets(SegIndex, SegOffset,
551  PointerSize, Count, Skip);
552  }
553 
554  // Given a SegIndex, SegOffset, and PointerSize, verify a valid section exists
555  // that fully contains a pointer at that location. Multiple fixups in a rebase
556  // (such as with the REBASE_OPCODE_DO_*_TIMES* opcodes) can be tested via the
557  // Count and Skip parameters.
558  //
559  // This is used by MachORebaseEntry::moveNext() to validate a MachORebaseEntry
560  const char *RebaseEntryCheckSegAndOffsets(int32_t SegIndex,
561  uint64_t SegOffset,
562  uint8_t PointerSize,
563  uint32_t Count=1,
564  uint32_t Skip=0) const {
565  return BindRebaseSectionTable->checkSegAndOffsets(SegIndex, SegOffset,
566  PointerSize, Count, Skip);
567  }
568 
569  /// For use with the SegIndex of a checked Mach-O Bind or Rebase entry to
570  /// get the segment name.
571  StringRef BindRebaseSegmentName(int32_t SegIndex) const {
572  return BindRebaseSectionTable->segmentName(SegIndex);
573  }
574 
575  /// For use with a SegIndex,SegOffset pair from a checked Mach-O Bind or
576  /// Rebase entry to get the section name.
577  StringRef BindRebaseSectionName(uint32_t SegIndex, uint64_t SegOffset) const {
578  return BindRebaseSectionTable->sectionName(SegIndex, SegOffset);
579  }
580 
581  /// For use with a SegIndex,SegOffset pair from a checked Mach-O Bind or
582  /// Rebase entry to get the address.
583  uint64_t BindRebaseAddress(uint32_t SegIndex, uint64_t SegOffset) const {
584  return BindRebaseSectionTable->address(SegIndex, SegOffset);
585  }
586 
587  // In a MachO file, sections have a segment name. This is used in the .o
588  // files. They have a single segment, but this field specifies which segment
589  // a section should be put in the final object.
591 
592  // Names are stored as 16 bytes. These returns the raw 16 bytes without
593  // interpreting them as a C string.
596 
597  // MachO specific Info about relocations.
600  const MachO::any_relocation_info &RE) const;
603  const MachO::any_relocation_info &RE) const;
605  const MachO::any_relocation_info &RE) const;
607  const MachO::any_relocation_info &RE) const;
608  unsigned getAnyRelocationAddress(const MachO::any_relocation_info &RE) const;
609  unsigned getAnyRelocationPCRel(const MachO::any_relocation_info &RE) const;
610  unsigned getAnyRelocationLength(const MachO::any_relocation_info &RE) const;
611  unsigned getAnyRelocationType(const MachO::any_relocation_info &RE) const;
613 
614  // MachO specific structures.
617  MachO::section getSection(const LoadCommandInfo &L, unsigned Index) const;
618  MachO::section_64 getSection64(const LoadCommandInfo &L,unsigned Index) const;
621 
623  getLinkeditDataLoadCommand(const LoadCommandInfo &L) const;
625  getSegmentLoadCommand(const LoadCommandInfo &L) const;
627  getSegment64LoadCommand(const LoadCommandInfo &L) const;
629  getLinkerOptionLoadCommand(const LoadCommandInfo &L) const;
631  getVersionMinLoadCommand(const LoadCommandInfo &L) const;
633  getNoteLoadCommand(const LoadCommandInfo &L) const;
635  getBuildVersionLoadCommand(const LoadCommandInfo &L) const;
637  getBuildToolVersion(unsigned index) const;
639  getDylibIDLoadCommand(const LoadCommandInfo &L) const;
641  getDyldInfoLoadCommand(const LoadCommandInfo &L) const;
643  getDylinkerCommand(const LoadCommandInfo &L) const;
645  getUuidCommand(const LoadCommandInfo &L) const;
647  getRpathCommand(const LoadCommandInfo &L) const;
649  getSourceVersionCommand(const LoadCommandInfo &L) const;
651  getEntryPointCommand(const LoadCommandInfo &L) const;
653  getEncryptionInfoCommand(const LoadCommandInfo &L) const;
655  getEncryptionInfoCommand64(const LoadCommandInfo &L) const;
657  getSubFrameworkCommand(const LoadCommandInfo &L) const;
659  getSubUmbrellaCommand(const LoadCommandInfo &L) const;
661  getSubLibraryCommand(const LoadCommandInfo &L) const;
663  getSubClientCommand(const LoadCommandInfo &L) const;
665  getRoutinesCommand(const LoadCommandInfo &L) const;
667  getRoutinesCommand64(const LoadCommandInfo &L) const;
669  getThreadCommand(const LoadCommandInfo &L) const;
670 
673  const MachO::mach_header &getHeader() const;
674  const MachO::mach_header_64 &getHeader64() const;
675  uint32_t
677  unsigned Index) const;
679  unsigned Index) const;
688  /// If the optional is None, no header was found, but the object was well-formed.
690  getChainedFixupsHeader() const;
694  ArrayRef<uint8_t> getUuid() const;
695 
697  bool is64Bit() const;
699 
700  static StringRef guessLibraryShortName(StringRef Name, bool &isFramework,
701  StringRef &Suffix);
702 
703  static Triple::ArchType getArch(uint32_t CPUType, uint32_t CPUSubType);
704  static Triple getArchTriple(uint32_t CPUType, uint32_t CPUSubType,
705  const char **McpuDefault = nullptr,
706  const char **ArchFlag = nullptr);
707  static bool isValidArch(StringRef ArchFlag);
709  static Triple getHostArch();
710 
711  bool isRelocatableObject() const override;
712 
714 
717 
718  bool hasPageZeroSegment() const { return HasPageZeroSegment; }
719 
720  static bool classof(const Binary *v) {
721  return v->isMachO();
722  }
723 
724  static uint32_t
726  uint32_t VersionOrSDK = (SDK) ? C.sdk : C.version;
727  return (VersionOrSDK >> 16) & 0xffff;
728  }
729 
730  static uint32_t
732  uint32_t VersionOrSDK = (SDK) ? C.sdk : C.version;
733  return (VersionOrSDK >> 8) & 0xff;
734  }
735 
736  static uint32_t
738  uint32_t VersionOrSDK = (SDK) ? C.sdk : C.version;
739  return VersionOrSDK & 0xff;
740  }
741 
742  static std::string getBuildPlatform(uint32_t platform) {
743  switch (platform) {
744  case MachO::PLATFORM_MACOS: return "macos";
745  case MachO::PLATFORM_IOS: return "ios";
746  case MachO::PLATFORM_TVOS: return "tvos";
747  case MachO::PLATFORM_WATCHOS: return "watchos";
748  case MachO::PLATFORM_BRIDGEOS: return "bridgeos";
749  case MachO::PLATFORM_MACCATALYST: return "macCatalyst";
750  case MachO::PLATFORM_IOSSIMULATOR: return "iossimulator";
751  case MachO::PLATFORM_TVOSSIMULATOR: return "tvossimulator";
752  case MachO::PLATFORM_WATCHOSSIMULATOR: return "watchossimulator";
753  case MachO::PLATFORM_DRIVERKIT: return "driverkit";
754  default:
755  std::string ret;
757  ss << format_hex(platform, 8, true);
758  return ss.str();
759  }
760  }
761 
762  static std::string getBuildTool(uint32_t tools) {
763  switch (tools) {
764  case MachO::TOOL_CLANG: return "clang";
765  case MachO::TOOL_SWIFT: return "swift";
766  case MachO::TOOL_LD: return "ld";
767  default:
768  std::string ret;
770  ss << format_hex(tools, 8, true);
771  return ss.str();
772  }
773  }
774 
775  static std::string getVersionString(uint32_t version) {
776  uint32_t major = (version >> 16) & 0xffff;
777  uint32_t minor = (version >> 8) & 0xff;
778  uint32_t update = version & 0xff;
779 
781  Version = utostr(major) + "." + utostr(minor);
782  if (update != 0)
783  Version += "." + utostr(update);
784  return std::string(std::string(Version.str()));
785  }
786 
787  /// If the input path is a .dSYM bundle (as created by the dsymutil tool),
788  /// return the paths to the object files found in the bundle, otherwise return
789  /// an empty vector. If the path appears to be a .dSYM bundle but no objects
790  /// were found or there was a filesystem error, then return an error.
793 
794 private:
795  MachOObjectFile(MemoryBufferRef Object, bool IsLittleEndian, bool Is64Bits,
796  Error &Err, uint32_t UniversalCputype = 0,
797  uint32_t UniversalIndex = 0);
798 
799  uint64_t getSymbolValueImpl(DataRefImpl Symb) const override;
800 
801  union {
804  };
805  using SectionList = SmallVector<const char*, 1>;
806  SectionList Sections;
807  using LibraryList = SmallVector<const char*, 1>;
808  LibraryList Libraries;
809  LoadCommandList LoadCommands;
810  using LibraryShortName = SmallVector<StringRef, 1>;
811  using BuildToolList = SmallVector<const char*, 1>;
812  BuildToolList BuildTools;
813  mutable LibraryShortName LibrariesShortNames;
814  std::unique_ptr<BindRebaseSegInfo> BindRebaseSectionTable;
815  const char *SymtabLoadCmd = nullptr;
816  const char *DysymtabLoadCmd = nullptr;
817  const char *DataInCodeLoadCmd = nullptr;
818  const char *LinkOptHintsLoadCmd = nullptr;
819  const char *DyldInfoLoadCmd = nullptr;
820  const char *FuncStartsLoadCmd = nullptr;
821  const char *DyldChainedFixupsLoadCmd = nullptr;
822  const char *UuidLoadCmd = nullptr;
823  bool HasPageZeroSegment = false;
824 };
825 
826 /// DiceRef
827 inline DiceRef::DiceRef(DataRefImpl DiceP, const ObjectFile *Owner)
828  : DicePimpl(DiceP) , OwningObject(Owner) {}
829 
830 inline bool DiceRef::operator==(const DiceRef &Other) const {
831  return DicePimpl == Other.DicePimpl;
832 }
833 
834 inline bool DiceRef::operator<(const DiceRef &Other) const {
835  return DicePimpl < Other.DicePimpl;
836 }
837 
838 inline void DiceRef::moveNext() {
840  reinterpret_cast<const MachO::data_in_code_entry *>(DicePimpl.p);
841  DicePimpl.p = reinterpret_cast<uintptr_t>(P + 1);
842 }
843 
844 // Since a Mach-O data in code reference, a DiceRef, can only be created when
845 // the OwningObject ObjectFile is a MachOObjectFile a static_cast<> is used for
846 // the methods that get the values of the fields of the reference.
847 
848 inline std::error_code DiceRef::getOffset(uint32_t &Result) const {
849  const MachOObjectFile *MachOOF =
850  static_cast<const MachOObjectFile *>(OwningObject);
851  MachO::data_in_code_entry Dice = MachOOF->getDice(DicePimpl);
852  Result = Dice.offset;
853  return std::error_code();
854 }
855 
856 inline std::error_code DiceRef::getLength(uint16_t &Result) const {
857  const MachOObjectFile *MachOOF =
858  static_cast<const MachOObjectFile *>(OwningObject);
859  MachO::data_in_code_entry Dice = MachOOF->getDice(DicePimpl);
860  Result = Dice.length;
861  return std::error_code();
862 }
863 
864 inline std::error_code DiceRef::getKind(uint16_t &Result) const {
865  const MachOObjectFile *MachOOF =
866  static_cast<const MachOObjectFile *>(OwningObject);
867  MachO::data_in_code_entry Dice = MachOOF->getDice(DicePimpl);
868  Result = Dice.kind;
869  return std::error_code();
870 }
871 
873  return DicePimpl;
874 }
875 
876 inline const ObjectFile *DiceRef::getObjectFile() const {
877  return OwningObject;
878 }
879 
880 } // end namespace object
881 } // end namespace llvm
882 
883 #endif // LLVM_OBJECT_MACHO_H
llvm::object::MachOObjectFile::getRelocationSymbol
symbol_iterator getRelocationSymbol(DataRefImpl Rel) const override
Definition: MachOObjectFile.cpp:2194
llvm::MachO::sub_library_command
Definition: MachO.h:643
llvm::object::ChainedFixupTarget::weakBind
bool weakBind()
Definition: MachO.h:286
MemoryBuffer.h
llvm::object::MachOObjectFile::getSubUmbrellaCommand
MachO::sub_umbrella_command getSubUmbrellaCommand(const LoadCommandInfo &L) const
Definition: MachOObjectFile.cpp:4554
llvm::object::MachOObjectFile::getPlainRelocationExternal
bool getPlainRelocationExternal(const MachO::any_relocation_info &RE) const
Definition: MachOObjectFile.cpp:4365
llvm::MachO::section
Definition: MachO.h:565
llvm::object::MachOObjectFile::getVersionString
static std::string getVersionString(uint32_t version)
Definition: MachO.h:775
llvm::object::MachOAbstractFixupEntry::segmentAddress
uint64_t segmentAddress() const
Definition: MachOObjectFile.cpp:3222
llvm::object::ExportEntry::nodeOffset
uint32_t nodeOffset() const
Definition: MachOObjectFile.cpp:2937
llvm::object::MachOObjectFile::getStringTableData
StringRef getStringTableData() const
Definition: MachOObjectFile.cpp:4871
llvm::MachO::PLATFORM_MACOS
@ PLATFORM_MACOS
Definition: MachO.h:494
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
llvm::MachO::PLATFORM_WATCHOSSIMULATOR
@ PLATFORM_WATCHOSSIMULATOR
Definition: MachO.h:502
llvm::object::MachORebaseEntry::address
uint64_t address() const
Definition: MachOObjectFile.cpp:3599
llvm::object::MachOObjectFile::getVersionMinMajor
static uint32_t getVersionMinMajor(MachO::version_min_command &C, bool SDK)
Definition: MachO.h:725
llvm::object::MachOAbstractFixupEntry
MachOAbstractFixupEntry is an abstract class representing a fixup in a MH_DYLDLINK file.
Definition: MachO.h:307
llvm::MachO::any_relocation_info
Definition: MachO.h:977
llvm::make_range
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
Definition: iterator_range.h:53
llvm::MachO::sub_umbrella_command
Definition: MachO.h:637
llvm::MachO::data_in_code_entry::length
uint16_t length
Definition: MachO.h:809
llvm::MachO::data_in_code_entry::kind
uint16_t kind
Definition: MachO.h:810
llvm::object::MachOObjectFile::getUuidCommand
MachO::uuid_command getUuidCommand(const LoadCommandInfo &L) const
Definition: MachOObjectFile.cpp:4519
llvm::object::MachOObjectFile::getSourceVersionCommand
MachO::source_version_command getSourceVersionCommand(const LoadCommandInfo &L) const
Definition: MachOObjectFile.cpp:4529
llvm::object::MachOObjectFile::fixupTable
iterator_range< fixup_iterator > fixupTable(Error &Err)
For iterating over all chained fixups.
Definition: MachOObjectFile.cpp:4303
llvm::object::MachOObjectFile::getRelocationLength
uint8_t getRelocationLength(DataRefImpl Rel) const
Definition: MachOObjectFile.cpp:2334
llvm::object::MachOChainedFixupEntry::MachOChainedFixupEntry
MachOChainedFixupEntry(Error *Err, const MachOObjectFile *O, bool Parse)
Definition: MachOObjectFile.cpp:3259
return
return
Definition: README.txt:242
llvm::object::MachOAbstractFixupEntry::moveToEnd
void moveToEnd()
Definition: MachOObjectFile.cpp:3257
llvm::object::MachOBindEntry::flags
uint32_t flags() const
Definition: MachOObjectFile.cpp:4133
StringRef.h
llvm::object::MachOObjectFile::findDsymObjectMembers
static Expected< std::vector< std::string > > findDsymObjectMembers(StringRef Path)
If the input path is a .dSYM bundle (as created by the dsymutil tool), return the paths to the object...
Definition: MachOObjectFile.cpp:4925
P
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
Definition: README-SSE.txt:411
llvm::MachO::nlist
Definition: MachO.h:989
is64Bit
static bool is64Bit(const char *name)
Definition: X86Disassembler.cpp:1018
llvm::object::MachOObjectFile::ReadULEB128s
void ReadULEB128s(uint64_t Index, SmallVectorImpl< uint64_t > &Out) const
Definition: MachOObjectFile.cpp:4881
llvm::object::MachOObjectFile::getRelocationRelocatedSection
section_iterator getRelocationRelocatedSection(relocation_iterator Rel) const
Definition: MachOObjectFile.cpp:2540
llvm::object::ChainedFixupTarget::ChainedFixupTarget
ChainedFixupTarget(int LibOrdinal, StringRef Symbol, uint64_t Addend, bool WeakImport)
Definition: MachO.h:277
llvm::raw_string_ostream
A raw_ostream that writes to an std::string.
Definition: raw_ostream.h:632
llvm::object::MachOObjectFile::getSectionIndex
uint64_t getSectionIndex(DataRefImpl Sec) const override
Definition: MachOObjectFile.cpp:1931
llvm::object::MachOObjectFile::getSectionSize
uint64_t getSectionSize(DataRefImpl Sec) const override
Definition: MachOObjectFile.cpp:1935
llvm::SmallVector< NodeState, 16 >
llvm::object::MachOBindEntry::typeName
StringRef typeName() const
Definition: MachOObjectFile.cpp:4117
llvm::object::MachOAbstractFixupEntry::typeName
StringRef typeName() const
Definition: MachOObjectFile.cpp:3246
llvm::object::BindRebaseSegInfo::sectionName
StringRef sectionName(int32_t SegIndex, uint64_t SegOffset)
Definition: MachOObjectFile.cpp:4261
llvm::object::MachOAbstractFixupEntry::Addend
int64_t Addend
Definition: MachO.h:348
llvm::object::MachOBindEntry::moveNext
void moveNext()
Definition: MachOObjectFile.cpp:3648
tools
The object format emitted by the WebAssembly backed is documented see the home tools
Definition: README.txt:16
llvm::object::MachOBindEntry::segmentName
StringRef segmentName() const
Definition: MachOObjectFile.cpp:4139
llvm::object::MachOAbstractFixupEntry::MachOAbstractFixupEntry
MachOAbstractFixupEntry(Error *Err, const MachOObjectFile *O)
Definition: MachOObjectFile.cpp:3195
llvm::object::MachOObjectFile::isSectionText
bool isSectionText(DataRefImpl Sec) const override
Definition: MachOObjectFile.cpp:2024
llvm::object::MachOObjectFile::getSegmentLoadCommand
MachO::segment_command getSegmentLoadCommand(const LoadCommandInfo &L) const
Definition: MachOObjectFile.cpp:4469
llvm::MachO::rpath_command
Definition: MachO.h:794
llvm::object::MachOObjectFile::getRoutinesCommand
MachO::routines_command getRoutinesCommand(const LoadCommandInfo &L) const
Definition: MachOObjectFile.cpp:4569
Error.h
llvm::object::MachOObjectFile::weakBindTable
iterator_range< bind_iterator > weakBindTable(Error &Err)
For use iterating over all weak bind table entries.
Definition: MachOObjectFile.cpp:4298
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
llvm::object::MachOObjectFile::mapReflectionSectionNameToEnumValue
llvm::binaryformat::Swift5ReflectionSectionKind mapReflectionSectionNameToEnumValue(StringRef SectionName) const override
Definition: MachOObjectFile.cpp:4968
llvm::MachO::PLATFORM_IOS
@ PLATFORM_IOS
Definition: MachO.h:495
llvm::object::MachOAbstractFixupEntry::Ordinal
int32_t Ordinal
Definition: MachO.h:346
llvm::MachO::sub_framework_command
Definition: MachO.h:625
llvm::MachO::data_in_code_entry::offset
uint32_t offset
Definition: MachO.h:808
llvm::object::MachOChainedFixupEntry::FixupKind
FixupKind
Definition: MachO.h:365
llvm::object::MachOObjectFile::isValidArch
static bool isValidArch(StringRef ArchFlag)
Definition: MachOObjectFile.cpp:2800
llvm::object::MachOChainedFixupEntry::moveToEnd
void moveToEnd()
Definition: MachOObjectFile.cpp:3280
llvm::object::DiceRef::moveNext
void moveNext()
Definition: MachO.h:838
llvm::object::MachOObjectFile::LoadCommandInfo
Definition: MachO.h:383
llvm::object::MachOObjectFile::locrel_begin
relocation_iterator locrel_begin() const
Definition: MachOObjectFile.cpp:2164
llvm::object::MachORebaseEntry::operator==
bool operator==(const MachORebaseEntry &) const
Definition: MachOObjectFile.cpp:3603
llvm::MachO::BIND_SPECIAL_DYLIB_WEAK_LOOKUP
@ BIND_SPECIAL_DYLIB_WEAK_LOOKUP
Definition: MachO.h:259
llvm::object::MachOObjectFile::BindRebaseAddress
uint64_t BindRebaseAddress(uint32_t SegIndex, uint64_t SegOffset) const
For use with a SegIndex,SegOffset pair from a checked Mach-O Bind or Rebase entry to get the address.
Definition: MachO.h:583
llvm::object::MachOAbstractFixupEntry::ordinal
int ordinal() const
Definition: MachOObjectFile.cpp:3244
llvm::MachO::PLATFORM_MACCATALYST
@ PLATFORM_MACCATALYST
Definition: MachO.h:499
llvm::object::MachOObjectFile::getAnyRelocationAddress
unsigned getAnyRelocationAddress(const MachO::any_relocation_info &RE) const
Definition: MachOObjectFile.cpp:4387
llvm::MachO::symtab_command
Definition: MachO.h:695
Swift.h
llvm::MachO::build_version_command
Definition: MachO.h:857
llvm::object::MachOBindEntry::segmentOffset
uint64_t segmentOffset() const
Definition: MachOObjectFile.cpp:4115
llvm::object::MachOObjectFile::checkSymbolTable
Error checkSymbolTable() const
Definition: MachOObjectFile.cpp:1688
llvm::object::MachOObjectFile::getFunctionStarts
SmallVector< uint64_t > getFunctionStarts() const
Definition: MachOObjectFile.cpp:4848
llvm::object::MachOChainedFixupEntry::moveNext
void moveNext()
Definition: MachOObjectFile.cpp:3284
llvm::object::MachOObjectFile::BindRebaseSegmentName
StringRef BindRebaseSegmentName(int32_t SegIndex) const
For use with the SegIndex of a checked Mach-O Bind or Rebase entry to get the segment name.
Definition: MachO.h:571
llvm::object::MachOObjectFile::getSectionRawName
ArrayRef< char > getSectionRawName(DataRefImpl Sec) const
Definition: MachOObjectFile.cpp:4335
llvm::object::MachOAbstractFixupEntry::SegmentIndex
int32_t SegmentIndex
Definition: MachO.h:344
llvm::object::MachOObjectFile::getDyldInfoLoadCommand
MachO::dyld_info_command getDyldInfoLoadCommand(const LoadCommandInfo &L) const
Definition: MachOObjectFile.cpp:4509
llvm::object::MachOObjectFile::getAnyRelocationPCRel
unsigned getAnyRelocationPCRel(const MachO::any_relocation_info &RE) const
Definition: MachOObjectFile.cpp:4394
llvm::MachO::CPUType
CPUType
Definition: MachO.h:1441
error
#define error(X)
Definition: SymbolRecordMapping.cpp:14
llvm::object::MachOObjectFile::getBuildPlatform
static std::string getBuildPlatform(uint32_t platform)
Definition: MachO.h:742
ret
to esp esp setne al movzbw ax esp setg cl movzbw cx cmove cx cl jne LBB1_2 esp ret(also really horrible code on ppc). This is due to the expand code for 64-bit compares. GCC produces multiple branches
llvm::object::ChainedFixupTarget
ChainedFixupTarget holds all the information about an external symbol necessary to bind this binary t...
Definition: MachO.h:275
llvm::object::MachOObjectFile::load_command_iterator
LoadCommandList::const_iterator load_command_iterator
Definition: MachO.h:388
Offset
uint64_t Offset
Definition: ELFObjHandler.cpp:79
llvm::object::MachOObjectFile::isSectionStripped
bool isSectionStripped(DataRefImpl Sec) const override
When dsymutil generates the companion file, it strips all unnecessary sections (e....
Definition: MachOObjectFile.cpp:2117
llvm::object::MachOObjectFile::mapDebugSectionName
StringRef mapDebugSectionName(StringRef Name) const override
Maps a debug section name to a standard DWARF section name.
Definition: MachOObjectFile.cpp:4918
llvm::object::MachOObjectFile::getSegmentContents
ArrayRef< uint8_t > getSegmentContents(StringRef SegmentName) const
Return the raw contents of an entire segment.
Definition: MachOObjectFile.cpp:2078
llvm::MachO::TOOL_SWIFT
@ TOOL_SWIFT
Definition: MachO.h:507
llvm::Expected
Tagged union holding either a T or a Error.
Definition: APFloat.h:41
llvm::object::MachOObjectFile::getBuildVersionLoadCommand
MachO::build_version_command getBuildVersionLoadCommand(const LoadCommandInfo &L) const
Definition: MachOObjectFile.cpp:4494
llvm::object::MachOObjectFile::getRelocationSection
section_iterator getRelocationSection(DataRefImpl Rel) const
Definition: MachOObjectFile.cpp:2215
SymbolicFile.h
llvm::object::ExportEntry
ExportEntry encapsulates the current-state-of-the-walk used when doing a non-recursive walk of the tr...
Definition: MachO.h:73
Format.h
llvm::object::MachOObjectFile::getSymbolByIndex
symbol_iterator getSymbolByIndex(unsigned Index) const
Definition: MachOObjectFile.cpp:2570
llvm::object::MachOObjectFile::rebaseTable
iterator_range< rebase_iterator > rebaseTable(Error &Err)
For use iterating over all rebase table entries.
Definition: MachOObjectFile.cpp:3628
llvm::object::MachOObjectFile::classof
static bool classof(const Binary *v)
Definition: MachO.h:720
llvm::object::DiceRef::operator==
bool operator==(const DiceRef &Other) const
Definition: MachO.h:830
p
the resulting code requires compare and branches when and if * p
Definition: README.txt:396
llvm::MemoryBufferRef
Definition: MemoryBufferRef.h:22
llvm::object::MachOObjectFile::getSymbolIndex
uint64_t getSymbolIndex(DataRefImpl Symb) const
Definition: MachOObjectFile.cpp:2582
llvm::MachO::thread_command
Definition: MachO.h:664
llvm::object::MachOAbstractFixupEntry::segmentIndex
int32_t segmentIndex() const
Definition: MachOObjectFile.cpp:3216
llvm::object::MachOObjectFile::getSection
Expected< SectionRef > getSection(unsigned SectionIndex) const
Definition: MachOObjectFile.cpp:2000
llvm::MachO::uuid_command
Definition: MachO.h:788
llvm::object::MachOObjectFile::getDylibIDLoadCommand
MachO::dylib_command getDylibIDLoadCommand(const LoadCommandInfo &L) const
Definition: MachOObjectFile.cpp:4504
llvm::MachO::PLATFORM_IOSSIMULATOR
@ PLATFORM_IOSSIMULATOR
Definition: MachO.h:500
llvm::object::MachOObjectFile::symbol_end
basic_symbol_iterator symbol_end() const override
Definition: MachOObjectFile.cpp:2555
llvm::object::MachOAbstractFixupEntry::moveToFirst
void moveToFirst()
Definition: MachOObjectFile.cpp:3248
llvm::object::MachOChainedFixupEntry
Definition: MachO.h:363
llvm::MachO::dyld_info_command
Definition: MachO.h:867
llvm::object::MachOObjectFile::getIndirectSymbolTableEntry
uint32_t getIndirectSymbolTableEntry(const MachO::dysymtab_command &DLC, unsigned Index) const
Definition: MachOObjectFile.cpp:4625
llvm::object::MachOObjectFile::getSectionContents
ArrayRef< uint8_t > getSectionContents(uint32_t Offset, uint64_t Size) const
Definition: MachOObjectFile.cpp:1964
llvm::object::MachOBindEntry::sectionName
StringRef sectionName() const
Definition: MachOObjectFile.cpp:4145
readULEB128
static uint64_t readULEB128(WasmObjectFile::ReadContext &Ctx)
Definition: WasmObjectFile.cpp:102
llvm::object::ChainedFixupTarget::symbolName
StringRef symbolName()
Definition: MachO.h:283
llvm::object::MachOObjectFile::getSectionAlignment
uint64_t getSectionAlignment(DataRefImpl Sec) const override
Definition: MachOObjectFile.cpp:1987
llvm::object::MachOObjectFile::getLinkOptHintsLoadCommand
MachO::linkedit_data_command getLinkOptHintsLoadCommand() const
Definition: MachOObjectFile.cpp:4698
llvm::MachO::data_in_code_entry
Definition: MachO.h:807
llvm::MachO::sub_client_command
Definition: MachO.h:631
llvm::object::MachOAbstractFixupEntry::E
Error * E
Definition: MachO.h:341
llvm::object::MachOChainedFixupEntry::FixupKind::Bind
@ Bind
llvm::object::MachOObjectFile::getSubFrameworkCommand
MachO::sub_framework_command getSubFrameworkCommand(const LoadCommandInfo &L) const
Definition: MachOObjectFile.cpp:4549
llvm::object::MachOObjectFile::getScatteredRelocationType
uint32_t getScatteredRelocationType(const MachO::any_relocation_info &RE) const
Definition: MachOObjectFile.cpp:4382
SubtargetFeature.h
llvm::object::MachOObjectFile::getSymbolAddress
Expected< uint64_t > getSymbolAddress(DataRefImpl Symb) const override
Definition: MachOObjectFile.cpp:1812
llvm::object::MachOObjectFile::getDysymtabLoadCommand
MachO::dysymtab_command getDysymtabLoadCommand() const
Definition: MachOObjectFile.cpp:4654
llvm::object::MachOObjectFile::getRpathCommand
MachO::rpath_command getRpathCommand(const LoadCommandInfo &L) const
Definition: MachOObjectFile.cpp:4524
llvm::Triple::ArchType
ArchType
Definition: Triple.h:46
llvm::MachO::routines_command
Definition: MachO.h:669
llvm::object::MachOAbstractFixupEntry::Flags
uint32_t Flags
Definition: MachO.h:347
llvm::object::MachOObjectFile::getVersionMinLoadCommand
MachO::version_min_command getVersionMinLoadCommand(const LoadCommandInfo &L) const
Definition: MachOObjectFile.cpp:4484
llvm::object::BindRebaseSegInfo::checkSegAndOffsets
const char * checkSegAndOffsets(int32_t SegIndex, uint64_t SegOffset, uint8_t PointerSize, uint32_t Count=1, uint32_t Skip=0)
Definition: MachOObjectFile.cpp:4202
llvm::object::MachOAbstractFixupEntry::textAddress
uint64_t textAddress() const
Definition: MachO.h:357
SmallString.h
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
llvm::object::MachOObjectFile::isSectionCompressed
bool isSectionCompressed(DataRefImpl Sec) const override
Definition: MachOObjectFile.cpp:2020
llvm::object::ChainedFixupTarget::libOrdinal
int libOrdinal()
Definition: MachO.h:282
llvm::object::MachORebaseEntry::sectionName
StringRef sectionName() const
Definition: MachOObjectFile.cpp:3593
llvm::AMDGPU::CPol::DLC
@ DLC
Definition: SIDefines.h:303
llvm::object::MachOObjectFile::getLinkeditDataLoadCommand
MachO::linkedit_data_command getLinkeditDataLoadCommand(const LoadCommandInfo &L) const
Definition: MachOObjectFile.cpp:4464
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
llvm::object::MachOAbstractFixupEntry::rawValue
uint64_t rawValue() const
Definition: MachO.h:336
llvm::object::MachOObjectFile::LoadCommandInfo::C
MachO::load_command C
Definition: MachO.h:385
llvm::object::MachOObjectFile::getBuildTool
static std::string getBuildTool(uint32_t tools)
Definition: MachO.h:762
llvm::object::MachOAbstractFixupEntry::O
const MachOObjectFile * O
Definition: MachO.h:342
llvm::object::MachOObjectFile::getBuildToolVersion
MachO::build_tool_version getBuildToolVersion(unsigned index) const
Definition: MachOObjectFile.cpp:4499
llvm::object::MachOObjectFile::getUuid
ArrayRef< uint8_t > getUuid() const
Definition: MachOObjectFile.cpp:4863
llvm::object::MachOAbstractFixupEntry::addend
int64_t addend() const
Definition: MachOObjectFile.cpp:3240
llvm::object::MachOObjectFile::getDyldInfoLazyBindOpcodes
ArrayRef< uint8_t > getDyldInfoLazyBindOpcodes() const
Definition: MachOObjectFile.cpp:4754
llvm::SubtargetFeatures
Manages the enabling and disabling of subtarget specific features.
Definition: SubtargetFeature.h:183
llvm::object::MachOObjectFile::getRelocation
MachO::any_relocation_info getRelocation(DataRefImpl Rel) const
Definition: MachOObjectFile.cpp:4584
llvm::MachO::source_version_command
Definition: MachO.h:813
llvm::dwarf::Index
Index
Definition: Dwarf.h:472
NodeList
Definition: MicrosoftDemangle.cpp:37
llvm::object::DiceRef::getLength
std::error_code getLength(uint16_t &Result) const
Definition: MachO.h:856
llvm::object::MachOObjectFile::getRelocationOffset
uint64_t getRelocationOffset(DataRefImpl Rel) const override
Definition: MachOObjectFile.cpp:2185
llvm::MachO::linkedit_data_command
Definition: MachO.h:800
llvm::object::MachOAbstractFixupEntry::moveNext
void moveNext()
llvm::object::MachOBindEntry::operator==
bool operator==(const MachOBindEntry &) const
Definition: MachOObjectFile.cpp:4155
llvm::object::DiceRef::getObjectFile
const ObjectFile * getObjectFile() const
Definition: MachO.h:876
llvm::object::MachOObjectFile::getSymbolSectionID
unsigned getSymbolSectionID(SymbolRef Symb) const
Definition: MachOObjectFile.cpp:1910
llvm::MachO::TOOL_LD
@ TOOL_LD
Definition: MachO.h:507
llvm::object::MachOObjectFile::isSectionVirtual
bool isSectionVirtual(DataRefImpl Sec) const override
Definition: MachOObjectFile.cpp:2103
llvm::AMDGPU::ElfNote::SectionName
const char SectionName[]
Definition: AMDGPUPTNote.h:24
llvm::object::BindRebaseSegInfo::address
uint64_t address(uint32_t SegIndex, uint64_t SegOffset)
Definition: MachOObjectFile.cpp:4268
llvm::object::MachOObjectFile::moveRelocationNext
void moveRelocationNext(DataRefImpl &Rel) const override
Definition: MachOObjectFile.cpp:2181
llvm::object::DataRefImpl::p
uintptr_t p
Definition: SymbolicFile.h:41
llvm::IndexedInstrProf::Version
const uint64_t Version
Definition: InstrProf.h:1027
llvm::object::ChainedFixupTarget::weakImport
bool weakImport()
Definition: MachO.h:285
llvm::MachO::BindType
BindType
Definition: MachO.h:249
llvm::object::MachOObjectFile::getDataInCodeLoadCommand
MachO::linkedit_data_command getDataInCodeLoadCommand() const
Definition: MachOObjectFile.cpp:4684
llvm::object::MachOAbstractFixupEntry::sectionName
StringRef sectionName() const
Definition: MachOObjectFile.cpp:3230
llvm::object::MachOObjectFile::create
static Expected< std::unique_ptr< MachOObjectFile > > create(MemoryBufferRef Object, bool IsLittleEndian, bool Is64Bits, uint32_t UniversalCputype=0, uint32_t UniversalIndex=0)
Definition: MachOObjectFile.cpp:1248
llvm::object::MachOAbstractFixupEntry::PointerValue
uint64_t PointerValue
Definition: MachO.h:349
llvm::object::MachORebaseEntry::segmentName
StringRef segmentName() const
Definition: MachOObjectFile.cpp:3587
llvm::object::MachOBindEntry::Kind::Lazy
@ Lazy
llvm::object::MachOAbstractFixupEntry::pointerValue
uint64_t pointerValue() const
Definition: MachO.h:329
llvm::object::MachOChainedFixupEntry::FixupKind::Rebase
@ Rebase
llvm::SmallString< 256 >
llvm::object::MachOAbstractFixupEntry::address
uint64_t address() const
Definition: MachOObjectFile.cpp:3234
llvm::object::MachOObjectFile::getCommonSymbolSizeImpl
uint64_t getCommonSymbolSizeImpl(DataRefImpl Symb) const override
Definition: MachOObjectFile.cpp:1825
llvm::object::MachOObjectFile::getSectionRawFinalSegmentName
ArrayRef< char > getSectionRawFinalSegmentName(DataRefImpl Sec) const
Definition: MachOObjectFile.cpp:4343
llvm::object::MachOObjectFile::getSection64
MachO::section_64 getSection64(DataRefImpl DRI) const
Definition: MachOObjectFile.cpp:4434
llvm::object::ExportEntry::operator==
bool operator==(const ExportEntry &) const
Definition: MachOObjectFile.cpp:2887
llvm::object::SectionRef
This is a value type class that represents a single section in the list of sections in the object fil...
Definition: ObjectFile.h:80
llvm::object::MachOObjectFile
Definition: MachO.h:381
llvm::MachO::mach_header_64
Definition: MachO.h:521
llvm::object::MachOObjectFile::getDyldInfoWeakBindOpcodes
ArrayRef< uint8_t > getDyldInfoWeakBindOpcodes() const
Definition: MachOObjectFile.cpp:4740
llvm::object::ExportEntry::moveNext
void moveNext()
Definition: MachOObjectFile.cpp:3147
llvm::binaryformat::Swift5ReflectionSectionKind
Swift5ReflectionSectionKind
Definition: Swift.h:14
llvm::object::MachOObjectFile::getSectionType
unsigned getSectionType(SectionRef Sec) const
Definition: MachOObjectFile.cpp:1777
llvm::object::MachOObjectFile::getEntryPointCommand
MachO::entry_point_command getEntryPointCommand(const LoadCommandInfo &L) const
Definition: MachOObjectFile.cpp:4534
llvm::object::MachOObjectFile::getSectionID
unsigned getSectionID(SectionRef Sec) const
Definition: MachOObjectFile.cpp:2099
llvm::object::MachOObjectFile::LoadCommandList
SmallVector< LoadCommandInfo, 4 > LoadCommandList
Definition: MachO.h:387
llvm::object::MachOObjectFile::getFeatures
SubtargetFeatures getFeatures() const override
Definition: MachO.h:491
llvm::object::MachOObjectFile::getPlainRelocationSymbolNum
unsigned getPlainRelocationSymbolNum(const MachO::any_relocation_info &RE) const
Definition: MachOObjectFile.cpp:4358
llvm::object::MachOObjectFile::getDylinkerCommand
MachO::dylinker_command getDylinkerCommand(const LoadCommandInfo &L) const
Definition: MachOObjectFile.cpp:4514
llvm::MachO::dylib_command
Definition: MachO.h:619
llvm::RISCVFenceField::O
@ O
Definition: RISCVBaseInfo.h:239
llvm::object::MachOObjectFile::is64Bit
bool is64Bit() const
Definition: MachOObjectFile.cpp:4876
llvm::MachO::note_command
Definition: MachO.h:844
object
bar al al movzbl eax ret Missed when stored in a memory object
Definition: README.txt:1411
llvm::object::MachOObjectFile::getNoteLoadCommand
MachO::note_command getNoteLoadCommand(const LoadCommandInfo &L) const
Definition: MachOObjectFile.cpp:4489
index
splat index
Definition: README_ALTIVEC.txt:181
llvm::object::MachOObjectFile::getSymbol64TableEntry
MachO::nlist_64 getSymbol64TableEntry(DataRefImpl DRI) const
Definition: MachOObjectFile.cpp:4458
uint64_t
llvm::object::symbol_iterator
Definition: ObjectFile.h:207
llvm::object::MachOAbstractFixupEntry::RawValue
uint64_t RawValue
Definition: MachO.h:350
llvm::object::MachOObjectFile::external_relocations
iterator_range< relocation_iterator > external_relocations() const
Definition: MachO.h:452
llvm::object::MachOObjectFile::LoadCommandInfo::Ptr
const char * Ptr
Definition: MachO.h:384
llvm::object::MachOObjectFile::isSectionBitcode
bool isSectionBitcode(DataRefImpl Sec) const override
Definition: MachOObjectFile.cpp:2110
llvm::object::MachOObjectFile::BindEntryCheckSegAndOffsets
const char * BindEntryCheckSegAndOffsets(int32_t SegIndex, uint64_t SegOffset, uint8_t PointerSize, uint32_t Count=1, uint32_t Skip=0) const
Definition: MachO.h:547
llvm::MachO::build_tool_version
Definition: MachO.h:852
llvm::object::MachOObjectFile::getSymbolType
Expected< SymbolRef::Type > getSymbolType(DataRefImpl Symb) const override
Definition: MachOObjectFile.cpp:1830
llvm::object::MachOObjectFile::symbol_begin
basic_symbol_iterator symbol_begin() const override
Definition: MachOObjectFile.cpp:2546
llvm::object::MachOObjectFile::getDyldChainedFixupTargets
Expected< std::vector< ChainedFixupTarget > > getDyldChainedFixupTargets() const
Definition: MachOObjectFile.cpp:4824
llvm::object::MachORebaseEntry::MachORebaseEntry
MachORebaseEntry(Error *Err, const MachOObjectFile *O, ArrayRef< uint8_t > opcodes, bool is64Bit)
Definition: MachOObjectFile.cpp:3295
llvm::object::MachOObjectFile::getRoutinesCommand64
MachO::routines_command_64 getRoutinesCommand64(const LoadCommandInfo &L) const
Definition: MachOObjectFile.cpp:4574
StringExtras.h
llvm::object::MachOObjectFile::getDice
MachO::data_in_code_entry getDice(DataRefImpl Rel) const
Definition: MachOObjectFile.cpp:4611
llvm::object::MachOObjectFile::end_load_commands
load_command_iterator end_load_commands() const
Definition: MachOObjectFile.cpp:4319
llvm::object::MachOObjectFile::getVersionMinMinor
static uint32_t getVersionMinMinor(MachO::version_min_command &C, bool SDK)
Definition: MachO.h:731
ArrayRef.h
llvm::object::MachOObjectFile::getArchTriple
Triple getArchTriple(const char **McpuDefault=nullptr) const
llvm::MachO::PLATFORM_BRIDGEOS
@ PLATFORM_BRIDGEOS
Definition: MachO.h:498
llvm::MachO::linker_option_command
Definition: MachO.h:882
llvm::object::ExportEntry::other
uint64_t other() const
Definition: MachOObjectFile.cpp:2926
llvm::MachO::RebaseType
RebaseType
Definition: MachO.h:229
llvm::SmallVectorImpl< NodeState >::const_iterator
typename SuperClass::const_iterator const_iterator
Definition: SmallVector.h:559
llvm::object::MachOObjectFile::section_end
section_iterator section_end() const override
Definition: MachOObjectFile.cpp:2599
ObjectFile.h
llvm::object::MachOObjectFile::getLibraryShortNameByIndex
std::error_code getLibraryShortNameByIndex(unsigned Index, StringRef &) const
Definition: MachOObjectFile.cpp:2501
llvm::object::content_iterator
Definition: SymbolicFile.h:69
llvm::MachO::segment_command
Definition: MachO.h:537
llvm::object::MachOAbstractFixupEntry::SymbolName
StringRef SymbolName
Definition: MachO.h:345
llvm::object::MachOObjectFile::getDyldInfoRebaseOpcodes
ArrayRef< uint8_t > getDyldInfoRebaseOpcodes() const
Definition: MachOObjectFile.cpp:4712
iterator_range.h
llvm::MachO::dylinker_command
Definition: MachO.h:658
llvm::object::DiceRef
DiceRef - This is a value type class that represents a single data in code entry in the table in a Ma...
Definition: MachO.h:44
llvm::object::DiceRef::getRawDataRefImpl
DataRefImpl getRawDataRefImpl() const
Definition: MachO.h:872
llvm::object::MachOAbstractFixupEntry::segmentName
StringRef segmentName() const
Definition: MachOObjectFile.cpp:3226
llvm::object::MachOObjectFile::getScatteredRelocationScattered
bool getScatteredRelocationScattered(const MachO::any_relocation_info &RE) const
Definition: MachOObjectFile.cpp:4372
llvm::object::MachOObjectFile::getDyldInfoBindOpcodes
ArrayRef< uint8_t > getDyldInfoBindOpcodes() const
Definition: MachOObjectFile.cpp:4726
llvm::object::MachOObjectFile::getDataInCodeTableEntry
MachO::data_in_code_entry getDataInCodeTableEntry(uint32_t DataOffset, unsigned Index) const
Definition: MachOObjectFile.cpp:4633
Triple.h
llvm::object::MachOObjectFile::getArch
Triple::ArchType getArch() const override
llvm::object::DiceRef::getKind
std::error_code getKind(uint16_t &Result) const
Definition: MachO.h:864
llvm::object::MachOObjectFile::begin_load_commands
load_command_iterator begin_load_commands() const
Definition: MachOObjectFile.cpp:4314
llvm::MachO::load_command
Definition: MachO.h:532
llvm::object::BindRebaseSegInfo::segmentName
StringRef segmentName(int32_t SegIndex)
Definition: MachOObjectFile.cpp:4235
llvm::object::MachOObjectFile::extrel_begin
relocation_iterator extrel_begin() const
Definition: MachOObjectFile.cpp:2147
llvm::object::MachOAbstractFixupEntry::symbolName
StringRef symbolName() const
Definition: MachOObjectFile.cpp:3238
llvm::ArrayRef< uint8_t >
llvm::object::MachORebaseEntry::moveNext
void moveNext()
Definition: MachOObjectFile.cpp:3311
llvm::object::MachOObjectFile::getAnyRelocationSection
SectionRef getAnyRelocationSection(const MachO::any_relocation_info &RE) const
Definition: MachOObjectFile.cpp:4417
llvm::object::MachOObjectFile::getSymbolSection
Expected< section_iterator > getSymbolSection(DataRefImpl Symb) const override
Definition: MachOObjectFile.cpp:1895
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::object::ObjectFile
This class is the base class for all object file types.
Definition: ObjectFile.h:228
llvm::object::Binary
Definition: Binary.h:32
SegmentOffset
static Constant * SegmentOffset(IRBuilderBase &IRB, int Offset, unsigned AddressSpace)
Definition: X86ISelLowering.cpp:2785
llvm::object::DiceRef::getOffset
std::error_code getOffset(uint32_t &Result) const
Definition: MachO.h:848
llvm::object::MachOObjectFile::isMachOPairedReloc
static bool isMachOPairedReloc(uint64_t RelocType, uint64_t Arch)
Definition: MachOObjectFile.cpp:4979
uint32_t
llvm::object::ExportEntry::address
uint64_t address() const
Definition: MachOObjectFile.cpp:2922
llvm::MachO::segment_command_64
Definition: MachO.h:551
llvm::object::MachOObjectFile::exports
iterator_range< export_iterator > exports(Error &Err) const
For use iterating over all exported symbols.
Definition: MachOObjectFile.cpp:3191
llvm::object::DataRefImpl
Definition: SymbolicFile.h:35
llvm::object::MachOObjectFile::getRelocationTypeName
void getRelocationTypeName(DataRefImpl Rel, SmallVectorImpl< char > &Result) const override
Definition: MachOObjectFile.cpp:2224
llvm::object::MachOObjectFile::getEncryptionInfoCommand64
MachO::encryption_info_command_64 getEncryptionInfoCommand64(const LoadCommandInfo &L) const
Definition: MachOObjectFile.cpp:4544
llvm::object::MachOObjectFile::locrel_end
relocation_iterator locrel_end() const
Definition: MachOObjectFile.cpp:2172
llvm::object::MachOBindEntry::ordinal
int ordinal() const
Definition: MachOObjectFile.cpp:4135
llvm::object::MachOBindEntry::segmentIndex
int32_t segmentIndex() const
Definition: MachOObjectFile.cpp:4113
llvm::object::MachOObjectFile::isRelocationScattered
bool isRelocationScattered(const MachO::any_relocation_info &RE) const
Definition: MachOObjectFile.cpp:4351
llvm::object::MachOObjectFile::section_begin
section_iterator section_begin() const override
Definition: MachOObjectFile.cpp:2594
llvm::MachO::PLATFORM_TVOS
@ PLATFORM_TVOS
Definition: MachO.h:496
llvm::object::MachOObjectFile::getVersionMinUpdate
static uint32_t getVersionMinUpdate(MachO::version_min_command &C, bool SDK)
Definition: MachO.h:737
llvm::MachO::encryption_info_command_64
Definition: MachO.h:827
llvm::object::BindRebaseSegInfo
Definition: MachO.h:132
llvm::object::MachOObjectFile::getSymbolFlags
Expected< uint32_t > getSymbolFlags(DataRefImpl Symb) const override
Definition: MachOObjectFile.cpp:1855
llvm::MachO::dysymtab_command
Definition: MachO.h:704
llvm::object::MachOAbstractFixupEntry::flags
uint32_t flags() const
Definition: MachOObjectFile.cpp:3242
llvm::object::MachOObjectFile::Header
MachO::mach_header Header
Definition: MachO.h:803
llvm::object::MachOObjectFile::getSymtabLoadCommand
MachO::symtab_command getSymtabLoadCommand() const
Definition: MachOObjectFile.cpp:4639
llvm::object::MachOObjectFile::moveSectionNext
void moveSectionNext(DataRefImpl &Sec) const override
Definition: MachOObjectFile.cpp:1916
llvm::object::MachOObjectFile::extrel_end
relocation_iterator extrel_end() const
Definition: MachOObjectFile.cpp:2155
llvm::object::MachOObjectFile::getAnyRelocationType
unsigned getAnyRelocationType(const MachO::any_relocation_info &RE) const
Definition: MachOObjectFile.cpp:4409
llvm::AMDGPU::HSAMD::Kernel::Key::SymbolName
constexpr char SymbolName[]
Key for Kernel::Metadata::mSymbolName.
Definition: AMDGPUMetadata.h:386
llvm::MachO::section_64
Definition: MachO.h:579
llvm::object::MachOBindEntry::Kind
Kind
Definition: MachO.h:214
llvm::object::MachOObjectFile::getSymbolTableEntry
MachO::nlist getSymbolTableEntry(DataRefImpl DRI) const
Definition: MachOObjectFile.cpp:4452
llvm::object::MachOObjectFile::load_commands
iterator_range< load_command_iterator > load_commands() const
Definition: MachOObjectFile.cpp:4324
llvm::object::MachOAbstractFixupEntry::segmentOffset
uint64_t segmentOffset() const
Definition: MachOObjectFile.cpp:3218
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:50
llvm::object::MachOObjectFile::getSegment64LoadCommand
MachO::segment_command_64 getSegment64LoadCommand(const LoadCommandInfo &L) const
Definition: MachOObjectFile.cpp:4474
uint16_t
llvm::MachO::PLATFORM_TVOSSIMULATOR
@ PLATFORM_TVOSSIMULATOR
Definition: MachO.h:501
llvm::object::MachORebaseEntry::segmentIndex
int32_t segmentIndex() const
Definition: MachOObjectFile.cpp:3569
llvm::SectionName
Definition: DWARFSection.h:21
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:155
llvm::object::ExportEntry::name
StringRef name() const
Definition: MachOObjectFile.cpp:2914
llvm::object::MachOObjectFile::getHeader64
const MachO::mach_header_64 & getHeader64() const
Definition: MachOObjectFile.cpp:4620
llvm::MachO::routines_command_64
Definition: MachO.h:682
llvm::object::MachOBindEntry::Kind::Regular
@ Regular
llvm::object::ExportEntry::flags
uint64_t flags() const
Definition: MachOObjectFile.cpp:2918
llvm::object::MachOBindEntry::symbolName
StringRef symbolName() const
Definition: MachOObjectFile.cpp:4129
llvm::MachO::entry_point_command
Definition: MachO.h:928
llvm::object::MachOBindEntry::addend
int64_t addend() const
Definition: MachOObjectFile.cpp:4131
llvm::object::MachOBindEntry
MachOBindEntry encapsulates the current state in the decompression of binding opcodes.
Definition: MachO.h:212
llvm::MachO::mach_header
Definition: MachO.h:511
llvm::object::MachOObjectFile::getNValue
uint64_t getNValue(DataRefImpl Sym) const
Definition: MachOObjectFile.cpp:1783
llvm::object::Binary::isMachO
bool isMachO() const
Definition: Binary.h:126
llvm::object::MachOObjectFile::isDebugSection
bool isDebugSection(DataRefImpl Sec) const override
Definition: MachOObjectFile.cpp:2045
llvm::object::MachOObjectFile::getLibraryCount
uint32_t getLibraryCount() const
Definition: MachOObjectFile.cpp:2535
llvm::MachO::PLATFORM_WATCHOS
@ PLATFORM_WATCHOS
Definition: MachO.h:497
llvm::object::DiceRef::operator<
bool operator<(const DiceRef &Other) const
Definition: MachO.h:834
llvm::object::MachOObjectFile::hasPageZeroSegment
bool hasPageZeroSegment() const
Definition: MachO.h:718
llvm::object::MachOObjectFile::getSubClientCommand
MachO::sub_client_command getSubClientCommand(const LoadCommandInfo &L) const
Definition: MachOObjectFile.cpp:4564
llvm::ARMBuildAttrs::Symbol
@ Symbol
Definition: ARMBuildAttributes.h:83
llvm::object::MachOObjectFile::getIndirectName
std::error_code getIndirectName(DataRefImpl Symb, StringRef &Res) const
Definition: MachOObjectFile.cpp:1794
llvm::object::MachOObjectFile::getRelocationType
uint64_t getRelocationType(DataRefImpl Rel) const override
Definition: MachOObjectFile.cpp:2219
llvm::object::MachOObjectFile::getHostArch
static Triple getHostArch()
Definition: MachOObjectFile.cpp:2796
llvm::object::MachOObjectFile::getBytesInAddress
uint8_t getBytesInAddress() const override
The number of bytes used to represent an address in this object file format.
Definition: MachOObjectFile.cpp:2605
llvm::object::MachOObjectFile::getDyldInfoExportsTrie
ArrayRef< uint8_t > getDyldInfoExportsTrie() const
Definition: MachOObjectFile.cpp:4834
llvm::object::MachOAbstractFixupEntry::SegmentOffset
uint64_t SegmentOffset
Definition: MachO.h:343
Binary.h
llvm::MachO::nlist_64
Definition: MachO.h:997
llvm::object::MachOObjectFile::getScatteredRelocationValue
uint32_t getScatteredRelocationValue(const MachO::any_relocation_info &RE) const
Definition: MachOObjectFile.cpp:4377
llvm::object::MachOObjectFile::RebaseEntryCheckSegAndOffsets
const char * RebaseEntryCheckSegAndOffsets(int32_t SegIndex, uint64_t SegOffset, uint8_t PointerSize, uint32_t Count=1, uint32_t Skip=0) const
Definition: MachO.h:560
llvm::object::MachOObjectFile::bindTable
iterator_range< bind_iterator > bindTable(Error &Err)
For use iterating over all bind table entries.
Definition: MachOObjectFile.cpp:4288
SmallVector.h
llvm::object::MachOObjectFile::section_rel_begin
relocation_iterator section_rel_begin(DataRefImpl Sec) const override
llvm::object::ChainedFixupTarget::addend
uint64_t addend()
Definition: MachO.h:284
llvm::object::MachOObjectFile::getSectionFinalSegmentName
StringRef getSectionFinalSegmentName(DataRefImpl Sec) const
Definition: MachOObjectFile.cpp:4329
llvm::object::MachORebaseEntry
MachORebaseEntry encapsulates the current state in the decompression of rebasing opcodes.
Definition: MachO.h:168
llvm::object::MachORebaseEntry::typeName
StringRef typeName() const
Definition: MachOObjectFile.cpp:3573
llvm::MachO::PLATFORM_DRIVERKIT
@ PLATFORM_DRIVERKIT
Definition: MachO.h:503
llvm::object::MachOObjectFile::Header64
MachO::mach_header_64 Header64
Definition: MachO.h:802
llvm::object::MachOBindEntry::Kind::Weak
@ Weak
llvm::iterator_range
A range adaptor for a pair of iterators.
Definition: iterator_range.h:30
llvm::object::MachOObjectFile::begin_dices
dice_iterator begin_dices() const
Definition: MachOObjectFile.cpp:2850
llvm::object::MachOObjectFile::getAnyRelocationLength
unsigned getAnyRelocationLength(const MachO::any_relocation_info &RE) const
Definition: MachOObjectFile.cpp:4401
llvm::SmallVectorImpl< char >
llvm::object::MachOObjectFile::end_dices
dice_iterator end_dices() const
Definition: MachOObjectFile.cpp:2860
llvm::object::MachOObjectFile::getValidArchs
static ArrayRef< StringRef > getValidArchs()
Definition: MachOObjectFile.cpp:2805
llvm::object::MachOChainedFixupEntry::moveToFirst
void moveToFirst()
Definition: MachOObjectFile.cpp:3274
llvm::object::SymbolRef
This is a value type class that represents a single symbol in the list of symbols in the object file.
Definition: ObjectFile.h:167
llvm::object::ExportEntry::ExportEntry
ExportEntry(Error *Err, const MachOObjectFile *O, ArrayRef< uint8_t > Trie)
Definition: MachOObjectFile.cpp:2871
llvm::object::MachOObjectFile::guessLibraryShortName
static StringRef guessLibraryShortName(StringRef Name, bool &isFramework, StringRef &Suffix)
Definition: MachOObjectFile.cpp:2375
llvm::object::MachOBindEntry::address
uint64_t address() const
Definition: MachOObjectFile.cpp:4151
llvm::object::MachOChainedFixupEntry::FixupKind::WeakBind
@ WeakBind
llvm::object::MachOObjectFile::isSectionBSS
bool isSectionBSS(DataRefImpl Sec) const override
Definition: MachOObjectFile.cpp:2037
llvm::object::MachOObjectFile::getSectionAddress
uint64_t getSectionAddress(DataRefImpl Sec) const override
Definition: MachOObjectFile.cpp:1925
llvm::object::MachOObjectFile::getThreadCommand
MachO::thread_command getThreadCommand(const LoadCommandInfo &L) const
Definition: MachOObjectFile.cpp:4579
MachO.h
llvm::object::DiceRef::DiceRef
DiceRef()=default
llvm::object::MachOObjectFile::getHeader
const MachO::mach_header & getHeader() const
Definition: MachOObjectFile.cpp:4616
llvm::object::MachOObjectFile::BindRebaseSectionName
StringRef BindRebaseSectionName(uint32_t SegIndex, uint64_t SegOffset) const
For use with a SegIndex,SegOffset pair from a checked Mach-O Bind or Rebase entry to get the section ...
Definition: MachO.h:577
raw_ostream.h
llvm::object::MachOObjectFile::moveSymbolNext
void moveSymbolNext(DataRefImpl &Symb) const override
Definition: MachOObjectFile.cpp:1755
llvm::object::MachOObjectFile::getEncryptionInfoCommand
MachO::encryption_info_command getEncryptionInfoCommand(const LoadCommandInfo &L) const
Definition: MachOObjectFile.cpp:4539
llvm::object::MachOObjectFile::getChainedFixupsHeader
Expected< Optional< MachO::dyld_chained_fixups_header > > getChainedFixupsHeader() const
If the optional is None, no header was found, but the object was well-formed.
Definition: MachOObjectFile.cpp:4769
llvm::object::MachOObjectFile::getFileFormatName
StringRef getFileFormatName() const override
Definition: MachOObjectFile.cpp:2609
llvm::object::MachOObjectFile::getSymbolName
Expected< StringRef > getSymbolName(DataRefImpl Symb) const override
Definition: MachOObjectFile.cpp:1762
llvm::raw_string_ostream::str
std::string & str()
Returns the string's reference.
Definition: raw_ostream.h:650
llvm::format_hex
FormattedNumber format_hex(uint64_t N, unsigned Width, bool Upper=false)
format_hex - Output N as a fixed width hexadecimal.
Definition: Format.h:186
llvm::object::MachOChainedFixupEntry::operator==
bool operator==(const MachOChainedFixupEntry &) const
Definition: MachOObjectFile.cpp:3286
llvm::object::MachOObjectFile::isSectionData
bool isSectionData(DataRefImpl Sec) const override
Definition: MachOObjectFile.cpp:2029
llvm::object::MachOObjectFile::lazyBindTable
iterator_range< bind_iterator > lazyBindTable(Error &Err)
For use iterating over all lazy bind table entries.
Definition: MachOObjectFile.cpp:4293
llvm::object::BindRebaseSegInfo::BindRebaseSegInfo
BindRebaseSegInfo(const MachOObjectFile *Obj)
Definition: MachOObjectFile.cpp:4167
llvm::MachO::version_min_command
Definition: MachO.h:836
llvm::object::MachOObjectFile::getSectionName
Expected< StringRef > getSectionName(DataRefImpl Sec) const override
Definition: MachOObjectFile.cpp:1920
llvm::object::MachOObjectFile::section_rel_end
relocation_iterator section_rel_end(DataRefImpl Sec) const override
llvm::object::MachOChainedFixupEntry::FixupKind::All
@ All
llvm::object::MachOObjectFile::getSubLibraryCommand
MachO::sub_library_command getSubLibraryCommand(const LoadCommandInfo &L) const
Definition: MachOObjectFile.cpp:4559
llvm::object::MachORebaseEntry::segmentOffset
uint64_t segmentOffset() const
Definition: MachOObjectFile.cpp:3571
llvm::object::MachOAbstractFixupEntry::Done
bool Done
Definition: MachO.h:351
llvm::object::MachOObjectFile::getLinkerOptionLoadCommand
MachO::linker_option_command getLinkerOptionLoadCommand(const LoadCommandInfo &L) const
Definition: MachOObjectFile.cpp:4479
llvm::MachO::TOOL_CLANG
@ TOOL_CLANG
Definition: MachO.h:507
Other
Optional< std::vector< StOtherPiece > > Other
Definition: ELFYAML.cpp:1236
llvm::object::MachOObjectFile::isRelocatableObject
bool isRelocatableObject() const override
True if this is a relocatable object (.o/.obj).
Definition: MachOObjectFile.cpp:4893
llvm::MachO::encryption_info_command
Definition: MachO.h:819
llvm::object::ExportEntry::otherName
StringRef otherName() const
Definition: MachOObjectFile.cpp:2930
llvm::object::MachOObjectFile::getSymbolAlignment
uint32_t getSymbolAlignment(DataRefImpl Symb) const override
Definition: MachOObjectFile.cpp:1816
llvm::object::MachOBindEntry::MachOBindEntry
MachOBindEntry(Error *Err, const MachOObjectFile *O, ArrayRef< uint8_t > Opcodes, bool is64Bit, MachOBindEntry::Kind)
Definition: MachOObjectFile.cpp:3632