LLVM  8.0.1
ObjectFile.h
Go to the documentation of this file.
1 //===- ObjectFile.h - File format independent object file -------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file declares a file format independent ObjectFile class.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_OBJECT_OBJECTFILE_H
15 #define LLVM_OBJECT_OBJECTFILE_H
16 
17 #include "llvm/ADT/StringRef.h"
18 #include "llvm/ADT/Triple.h"
22 #include "llvm/Object/Binary.h"
23 #include "llvm/Object/Error.h"
25 #include "llvm/Support/Casting.h"
26 #include "llvm/Support/Error.h"
29 #include <cassert>
30 #include <cstdint>
31 #include <memory>
32 #include <system_error>
33 
34 namespace llvm {
35 
36 class ARMAttributeParser;
37 
38 namespace object {
39 
40 class COFFObjectFile;
41 class MachOObjectFile;
42 class ObjectFile;
43 class SectionRef;
44 class SymbolRef;
45 class symbol_iterator;
46 class WasmObjectFile;
47 
49 
50 /// This is a value type class that represents a single relocation in the list
51 /// of relocations in the object file.
53  DataRefImpl RelocationPimpl;
54  const ObjectFile *OwningObject = nullptr;
55 
56 public:
57  RelocationRef() = default;
58  RelocationRef(DataRefImpl RelocationP, const ObjectFile *Owner);
59 
60  bool operator==(const RelocationRef &Other) const;
61 
62  void moveNext();
63 
64  uint64_t getOffset() const;
65  symbol_iterator getSymbol() const;
66  uint64_t getType() const;
67 
68  /// Get a string that represents the type of this relocation.
69  ///
70  /// This is for display purposes only.
71  void getTypeName(SmallVectorImpl<char> &Result) const;
72 
74  const ObjectFile *getObject() const;
75 };
76 
78 
79 /// This is a value type class that represents a single section in the list of
80 /// sections in the object file.
81 class SectionRef {
82  friend class SymbolRef;
83 
84  DataRefImpl SectionPimpl;
85  const ObjectFile *OwningObject = nullptr;
86 
87 public:
88  SectionRef() = default;
89  SectionRef(DataRefImpl SectionP, const ObjectFile *Owner);
90 
91  bool operator==(const SectionRef &Other) const;
92  bool operator!=(const SectionRef &Other) const;
93  bool operator<(const SectionRef &Other) const;
94 
95  void moveNext();
96 
97  std::error_code getName(StringRef &Result) const;
98  uint64_t getAddress() const;
99  uint64_t getIndex() const;
100  uint64_t getSize() const;
101  std::error_code getContents(StringRef &Result) const;
102 
103  /// Get the alignment of this section as the actual value (not log 2).
104  uint64_t getAlignment() const;
105 
106  bool isCompressed() const;
107  /// Whether this section contains instructions.
108  bool isText() const;
109  /// Whether this section contains data, not instructions.
110  bool isData() const;
111  /// Whether this section contains BSS uninitialized data.
112  bool isBSS() const;
113  bool isVirtual() const;
114  bool isBitcode() const;
115  bool isStripped() const;
116 
117  /// Whether this section will be placed in the text segment, according to the
118  /// Berkeley size format. This is true if the section is allocatable, and
119  /// contains either code or readonly data.
120  bool isBerkeleyText() const;
121  /// Whether this section will be placed in the data segment, according to the
122  /// Berkeley size format. This is true if the section is allocatable and
123  /// contains data (e.g. PROGBITS), but is not text.
124  bool isBerkeleyData() const;
125 
126  bool containsSymbol(SymbolRef S) const;
127 
128  relocation_iterator relocation_begin() const;
129  relocation_iterator relocation_end() const;
131  return make_range(relocation_begin(), relocation_end());
132  }
133  section_iterator getRelocatedSection() const;
134 
136  const ObjectFile *getObject() const;
137 };
138 
139 /// This is a value type class that represents a single symbol in the list of
140 /// symbols in the object file.
141 class SymbolRef : public BasicSymbolRef {
142  friend class SectionRef;
143 
144 public:
145  enum Type {
146  ST_Unknown, // Type not specified
151  ST_Other
152  };
153 
154  SymbolRef() = default;
155  SymbolRef(DataRefImpl SymbolP, const ObjectFile *Owner);
157  assert(isa<ObjectFile>(BasicSymbolRef::getObject()));
158  }
159 
161  /// Returns the symbol virtual address (i.e. address at which it will be
162  /// mapped).
163  Expected<uint64_t> getAddress() const;
164 
165  /// Return the value of the symbol depending on the object this can be an
166  /// offset or a virtual address.
167  uint64_t getValue() const;
168 
169  /// Get the alignment of this symbol as the actual value (not log 2).
170  uint32_t getAlignment() const;
171  uint64_t getCommonSize() const;
173 
174  /// Get section this symbol is defined in reference to. Result is
175  /// end_sections() if it is undefined or is an absolute symbol.
177 
178  const ObjectFile *getObject() const;
179 };
180 
182 public:
186  cast<ObjectFile>(B->getObject()))) {}
187 
188  const SymbolRef *operator->() const {
190  return static_cast<const SymbolRef*>(&P);
191  }
192 
193  const SymbolRef &operator*() const {
195  return static_cast<const SymbolRef&>(P);
196  }
197 };
198 
199 /// This class is the base class for all object file types. Concrete instances
200 /// of this object are created by createObjectFile, which figures out which type
201 /// to create.
202 class ObjectFile : public SymbolicFile {
203  virtual void anchor();
204 
205 protected:
206  ObjectFile(unsigned int Type, MemoryBufferRef Source);
207 
208  const uint8_t *base() const {
209  return reinterpret_cast<const uint8_t *>(Data.getBufferStart());
210  }
211 
212  // These functions are for SymbolRef to call internally. The main goal of
213  // this is to allow SymbolRef::SymbolPimpl to point directly to the symbol
214  // entry in the memory mapped object file. SymbolPimpl cannot contain any
215  // virtual functions because then it could not point into the memory mapped
216  // file.
217  //
218  // Implementations assume that the DataRefImpl is valid and has not been
219  // modified externally. It's UB otherwise.
220  friend class SymbolRef;
221 
222  virtual Expected<StringRef> getSymbolName(DataRefImpl Symb) const = 0;
223  std::error_code printSymbolName(raw_ostream &OS,
224  DataRefImpl Symb) const override;
225  virtual Expected<uint64_t> getSymbolAddress(DataRefImpl Symb) const = 0;
226  virtual uint64_t getSymbolValueImpl(DataRefImpl Symb) const = 0;
227  virtual uint32_t getSymbolAlignment(DataRefImpl Symb) const;
228  virtual uint64_t getCommonSymbolSizeImpl(DataRefImpl Symb) const = 0;
229  virtual Expected<SymbolRef::Type> getSymbolType(DataRefImpl Symb) const = 0;
231  getSymbolSection(DataRefImpl Symb) const = 0;
232 
233  // Same as above for SectionRef.
234  friend class SectionRef;
235 
236  virtual void moveSectionNext(DataRefImpl &Sec) const = 0;
237  virtual std::error_code getSectionName(DataRefImpl Sec,
238  StringRef &Res) const = 0;
239  virtual uint64_t getSectionAddress(DataRefImpl Sec) const = 0;
240  virtual uint64_t getSectionIndex(DataRefImpl Sec) const = 0;
241  virtual uint64_t getSectionSize(DataRefImpl Sec) const = 0;
242  virtual std::error_code getSectionContents(DataRefImpl Sec,
243  StringRef &Res) const = 0;
244  virtual uint64_t getSectionAlignment(DataRefImpl Sec) const = 0;
245  virtual bool isSectionCompressed(DataRefImpl Sec) const = 0;
246  virtual bool isSectionText(DataRefImpl Sec) const = 0;
247  virtual bool isSectionData(DataRefImpl Sec) const = 0;
248  virtual bool isSectionBSS(DataRefImpl Sec) const = 0;
249  // A section is 'virtual' if its contents aren't present in the object image.
250  virtual bool isSectionVirtual(DataRefImpl Sec) const = 0;
251  virtual bool isSectionBitcode(DataRefImpl Sec) const;
252  virtual bool isSectionStripped(DataRefImpl Sec) const;
253  virtual bool isBerkeleyText(DataRefImpl Sec) const;
254  virtual bool isBerkeleyData(DataRefImpl Sec) const;
255  virtual relocation_iterator section_rel_begin(DataRefImpl Sec) const = 0;
256  virtual relocation_iterator section_rel_end(DataRefImpl Sec) const = 0;
257  virtual section_iterator getRelocatedSection(DataRefImpl Sec) const;
258 
259  // Same as above for RelocationRef.
260  friend class RelocationRef;
261  virtual void moveRelocationNext(DataRefImpl &Rel) const = 0;
262  virtual uint64_t getRelocationOffset(DataRefImpl Rel) const = 0;
263  virtual symbol_iterator getRelocationSymbol(DataRefImpl Rel) const = 0;
264  virtual uint64_t getRelocationType(DataRefImpl Rel) const = 0;
265  virtual void getRelocationTypeName(DataRefImpl Rel,
266  SmallVectorImpl<char> &Result) const = 0;
267 
268  uint64_t getSymbolValue(DataRefImpl Symb) const;
269 
270 public:
271  ObjectFile() = delete;
272  ObjectFile(const ObjectFile &other) = delete;
273 
274  uint64_t getCommonSymbolSize(DataRefImpl Symb) const {
275  assert(getSymbolFlags(Symb) & SymbolRef::SF_Common);
276  return getCommonSymbolSizeImpl(Symb);
277  }
278 
279  virtual std::vector<SectionRef> dynamic_relocation_sections() const {
280  return std::vector<SectionRef>();
281  }
282 
285  return symbol_iterator_range(symbol_begin(), symbol_end());
286  }
287 
288  virtual section_iterator section_begin() const = 0;
289  virtual section_iterator section_end() const = 0;
290 
293  return section_iterator_range(section_begin(), section_end());
294  }
295 
296  /// The number of bytes used to represent an address in this object
297  /// file format.
298  virtual uint8_t getBytesInAddress() const = 0;
299 
300  virtual StringRef getFileFormatName() const = 0;
301  virtual Triple::ArchType getArch() const = 0;
302  virtual SubtargetFeatures getFeatures() const = 0;
303  virtual void setARMSubArch(Triple &TheTriple) const { }
306  };
307 
308  /// Create a triple from the data in this object file.
309  Triple makeTriple() const;
310 
311  virtual std::error_code
313  return std::error_code();
314  }
315 
316  /// Maps a debug section name to a standard DWARF section name.
317  virtual StringRef mapDebugSectionName(StringRef Name) const { return Name; }
318 
319  /// True if this is a relocatable object (.o/.obj).
320  virtual bool isRelocatableObject() const = 0;
321 
322  /// @returns Pointer to ObjectFile subclass to handle this type of object.
323  /// @param ObjectPath The path to the object file. ObjectPath.isObject must
324  /// return true.
325  /// Create ObjectFile from path.
327  createObjectFile(StringRef ObjectPath);
328 
330  createObjectFile(MemoryBufferRef Object, llvm::file_magic Type);
333  return createObjectFile(Object, llvm::file_magic::unknown);
334  }
335 
336  static bool classof(const Binary *v) {
337  return v->isObject();
338  }
339 
341  createCOFFObjectFile(MemoryBufferRef Object);
342 
344  createELFObjectFile(MemoryBufferRef Object);
345 
347  createMachOObjectFile(MemoryBufferRef Object,
348  uint32_t UniversalCputype = 0,
349  uint32_t UniversalIndex = 0);
350 
352  createWasmObjectFile(MemoryBufferRef Object);
353 };
354 
355 // Inline function definitions.
356 inline SymbolRef::SymbolRef(DataRefImpl SymbolP, const ObjectFile *Owner)
357  : BasicSymbolRef(SymbolP, Owner) {}
358 
361 }
362 
365 }
366 
367 inline uint64_t SymbolRef::getValue() const {
369 }
370 
373 }
374 
375 inline uint64_t SymbolRef::getCommonSize() const {
377 }
378 
381 }
382 
385 }
386 
387 inline const ObjectFile *SymbolRef::getObject() const {
389  return cast<ObjectFile>(O);
390 }
391 
392 /// SectionRef
394  const ObjectFile *Owner)
395  : SectionPimpl(SectionP)
396  , OwningObject(Owner) {}
397 
398 inline bool SectionRef::operator==(const SectionRef &Other) const {
399  return SectionPimpl == Other.SectionPimpl;
400 }
401 
402 inline bool SectionRef::operator!=(const SectionRef &Other) const {
403  return SectionPimpl != Other.SectionPimpl;
404 }
405 
406 inline bool SectionRef::operator<(const SectionRef &Other) const {
407  return SectionPimpl < Other.SectionPimpl;
408 }
409 
410 inline void SectionRef::moveNext() {
411  return OwningObject->moveSectionNext(SectionPimpl);
412 }
413 
414 inline std::error_code SectionRef::getName(StringRef &Result) const {
415  return OwningObject->getSectionName(SectionPimpl, Result);
416 }
417 
418 inline uint64_t SectionRef::getAddress() const {
419  return OwningObject->getSectionAddress(SectionPimpl);
420 }
421 
422 inline uint64_t SectionRef::getIndex() const {
423  return OwningObject->getSectionIndex(SectionPimpl);
424 }
425 
426 inline uint64_t SectionRef::getSize() const {
427  return OwningObject->getSectionSize(SectionPimpl);
428 }
429 
430 inline std::error_code SectionRef::getContents(StringRef &Result) const {
431  return OwningObject->getSectionContents(SectionPimpl, Result);
432 }
433 
434 inline uint64_t SectionRef::getAlignment() const {
435  return OwningObject->getSectionAlignment(SectionPimpl);
436 }
437 
438 inline bool SectionRef::isCompressed() const {
439  return OwningObject->isSectionCompressed(SectionPimpl);
440 }
441 
442 inline bool SectionRef::isText() const {
443  return OwningObject->isSectionText(SectionPimpl);
444 }
445 
446 inline bool SectionRef::isData() const {
447  return OwningObject->isSectionData(SectionPimpl);
448 }
449 
450 inline bool SectionRef::isBSS() const {
451  return OwningObject->isSectionBSS(SectionPimpl);
452 }
453 
454 inline bool SectionRef::isVirtual() const {
455  return OwningObject->isSectionVirtual(SectionPimpl);
456 }
457 
458 inline bool SectionRef::isBitcode() const {
459  return OwningObject->isSectionBitcode(SectionPimpl);
460 }
461 
462 inline bool SectionRef::isStripped() const {
463  return OwningObject->isSectionStripped(SectionPimpl);
464 }
465 
466 inline bool SectionRef::isBerkeleyText() const {
467  return OwningObject->isBerkeleyText(SectionPimpl);
468 }
469 
470 inline bool SectionRef::isBerkeleyData() const {
471  return OwningObject->isBerkeleyData(SectionPimpl);
472 }
473 
475  return OwningObject->section_rel_begin(SectionPimpl);
476 }
477 
479  return OwningObject->section_rel_end(SectionPimpl);
480 }
481 
483  return OwningObject->getRelocatedSection(SectionPimpl);
484 }
485 
487  return SectionPimpl;
488 }
489 
490 inline const ObjectFile *SectionRef::getObject() const {
491  return OwningObject;
492 }
493 
494 /// RelocationRef
496  const ObjectFile *Owner)
497  : RelocationPimpl(RelocationP)
498  , OwningObject(Owner) {}
499 
500 inline bool RelocationRef::operator==(const RelocationRef &Other) const {
501  return RelocationPimpl == Other.RelocationPimpl;
502 }
503 
504 inline void RelocationRef::moveNext() {
505  return OwningObject->moveRelocationNext(RelocationPimpl);
506 }
507 
508 inline uint64_t RelocationRef::getOffset() const {
509  return OwningObject->getRelocationOffset(RelocationPimpl);
510 }
511 
513  return OwningObject->getRelocationSymbol(RelocationPimpl);
514 }
515 
516 inline uint64_t RelocationRef::getType() const {
517  return OwningObject->getRelocationType(RelocationPimpl);
518 }
519 
521  return OwningObject->getRelocationTypeName(RelocationPimpl, Result);
522 }
523 
525  return RelocationPimpl;
526 }
527 
528 inline const ObjectFile *RelocationRef::getObject() const {
529  return OwningObject;
530 }
531 
532 } // end namespace object
533 
534 } // end namespace llvm
535 
536 #endif // LLVM_OBJECT_OBJECTFILE_H
const content_type & operator*() const
Definition: SymbolicFile.h:79
static uint64_t getSymbolValue(const MCSymbol &Symbol, const MCAsmLayout &Layout)
virtual bool isBerkeleyData(DataRefImpl Sec) const
Definition: ObjectFile.cpp:84
This class represents lattice values for constants.
Definition: AllocatorList.h:24
Expected< StringRef > getName() const
Definition: ObjectFile.h:359
uint64_t getValue() const
Return the value of the symbol depending on the object this can be an offset or a virtual address...
Definition: ObjectFile.h:367
uint64_t getOffset() const
Definition: ObjectFile.h:508
bool operator!=(const SectionRef &Other) const
Definition: ObjectFile.h:402
bool isStripped() const
Definition: ObjectFile.h:462
This provides a very simple, boring adaptor for a begin and end iterator into a range type...
bool operator<(const DataRefImpl &a, const DataRefImpl &b)
Definition: SymbolicFile.h:63
virtual bool isSectionBSS(DataRefImpl Sec) const =0
This class is the base class for all object file types.
Definition: ObjectFile.h:202
bool operator==(const RelocationRef &Other) const
Definition: ObjectFile.h:500
virtual uint64_t getRelocationOffset(DataRefImpl Rel) const =0
const uint8_t * base() const
Definition: ObjectFile.h:208
virtual std::error_code getSectionName(DataRefImpl Sec, StringRef &Res) const =0
uint32_t getAlignment() const
Get the alignment of this symbol as the actual value (not log 2).
Definition: ObjectFile.h:371
const ObjectFile * getObject() const
Definition: ObjectFile.h:528
virtual uint32_t getSymbolAlignment(DataRefImpl Symb) const
Definition: ObjectFile.cpp:69
virtual Expected< StringRef > getSymbolName(DataRefImpl Symb) const =0
virtual bool isSectionStripped(DataRefImpl Sec) const
Definition: ObjectFile.cpp:78
relocation_iterator relocation_end() const
Definition: ObjectFile.h:478
virtual relocation_iterator section_rel_end(DataRefImpl Sec) const =0
void getTypeName(SmallVectorImpl< char > &Result) const
Get a string that represents the type of this relocation.
Definition: ObjectFile.h:520
virtual std::error_code getBuildAttributes(ARMAttributeParser &Attributes) const
Definition: ObjectFile.h:312
static uint32_t getAlignment(const MCSectionCOFF &Sec)
amdgpu Simplify well known AMD library false Value Value const Twine & Name
uint64_t getAddress() const
Definition: ObjectFile.h:418
DataRefImpl getRawDataRefImpl() const
Definition: SymbolicFile.h:205
static StringRef getSymbolName(SymbolKind SymKind)
virtual std::error_code getSectionContents(DataRefImpl Sec, StringRef &Res) const =0
This is a value type class that represents a single relocation in the list of relocations in the obje...
Definition: ObjectFile.h:52
bool operator==(const SectionRef &Other) const
Definition: ObjectFile.h:398
static StringRef getName(Value *V)
bool isText() const
Whether this section contains instructions.
Definition: ObjectFile.h:442
virtual uint64_t getSectionIndex(DataRefImpl Sec) const =0
Tagged union holding either a T or a Error.
Definition: CachePruning.h:23
bool operator!=(const DataRefImpl &a, const DataRefImpl &b)
Definition: SymbolicFile.h:59
bool isBitcode() const
Definition: ObjectFile.h:458
ELFYAML::ELF_STO Other
Definition: ELFYAML.cpp:784
Expected< const typename ELFT::Shdr * > getSection(typename ELFT::ShdrRange Sections, uint32_t Index)
Definition: ELF.h:275
virtual relocation_iterator section_rel_begin(DataRefImpl Sec) const =0
uint64_t getIndex() const
Definition: ObjectFile.h:422
bool isCompressed() const
Definition: ObjectFile.h:438
uint64_t getCommonSize() const
Definition: ObjectFile.h:375
const ObjectFile * getObject() const
Definition: ObjectFile.h:387
virtual uint64_t getSectionAlignment(DataRefImpl Sec) const =0
section_iterator_range sections() const
Definition: ObjectFile.h:292
virtual Expected< uint64_t > getStartAddress() const
Definition: ObjectFile.h:304
virtual bool isSectionBitcode(DataRefImpl Sec) const
Definition: ObjectFile.cpp:71
const ObjectFile * getObject() const
Definition: ObjectFile.h:490
std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type cast(const Y &Val)
Definition: Casting.h:240
Expected< section_iterator > getSection() const
Get section this symbol is defined in reference to.
Definition: ObjectFile.h:379
virtual StringRef mapDebugSectionName(StringRef Name) const
Maps a debug section name to a standard DWARF section name.
Definition: ObjectFile.h:317
virtual Expected< SymbolRef::Type > getSymbolType(DataRefImpl Symb) const =0
#define P(N)
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
virtual void moveRelocationNext(DataRefImpl &Rel) const =0
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:46
bool isVirtual() const
Definition: ObjectFile.h:454
Error errorCodeToError(std::error_code EC)
Helper for converting an std::error_code to a Error.
Definition: Error.cpp:88
symbol_iterator(const basic_symbol_iterator &B)
Definition: ObjectFile.h:184
virtual std::vector< SectionRef > dynamic_relocation_sections() const
Definition: ObjectFile.h:279
uint64_t getSize() const
Definition: ObjectFile.h:426
relocation_iterator relocation_begin() const
Definition: ObjectFile.h:474
static Expected< std::unique_ptr< ObjectFile > > createObjectFile(MemoryBufferRef Object)
Definition: ObjectFile.h:332
bool operator<(const SectionRef &Other) const
Definition: ObjectFile.h:406
section_iterator getRelocatedSection() const
Definition: ObjectFile.h:482
Expected< uint64_t > getAddress() const
Returns the symbol virtual address (i.e.
Definition: ObjectFile.h:363
DataRefImpl getRawDataRefImpl() const
Definition: ObjectFile.h:486
bool isData() const
Whether this section contains data, not instructions.
Definition: ObjectFile.h:446
uint64_t getType() const
Definition: ObjectFile.h:516
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
SymbolRef(const BasicSymbolRef &B)
Definition: ObjectFile.h:156
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
bool isBerkeleyText() const
Whether this section will be placed in the text segment, according to the Berkeley size format...
Definition: ObjectFile.h:466
virtual Expected< uint64_t > getSymbolAddress(DataRefImpl Symb) const =0
bool isBSS() const
Whether this section contains BSS uninitialized data.
Definition: ObjectFile.h:450
Expected< SymbolRef::Type > getType() const
Definition: ObjectFile.h:383
bool isBitcode(const unsigned char *BufPtr, const unsigned char *BufEnd)
isBitcode - Return true if the given bytes are the magic bytes for LLVM IR bitcode, either with or without a wrapper.
const SymbolicFile * getObject() const
Definition: SymbolicFile.h:209
std::error_code getName(StringRef &Result) const
Definition: ObjectFile.h:414
virtual void setARMSubArch(Triple &TheTriple) const
Definition: ObjectFile.h:303
const SymbolRef & operator*() const
Definition: ObjectFile.h:193
virtual uint64_t getSectionAddress(DataRefImpl Sec) const =0
uint64_t getSymbolValue(DataRefImpl Symb) const
Definition: ObjectFile.cpp:51
virtual symbol_iterator getRelocationSymbol(DataRefImpl Rel) const =0
std::error_code getContents(StringRef &Result) const
Definition: ObjectFile.h:430
bool isObject() const
Definition: Binary.h:95
A range adaptor for a pair of iterators.
Manages the enabling and disabling of subtarget specific features.
virtual bool isSectionText(DataRefImpl Sec) const =0
This is a value type class that represents a single symbol in the list of symbols in the object file...
Definition: ObjectFile.h:141
static std::unique_ptr< PDBSymbol > getSymbolType(const PDBSymbol &Symbol)
Definition: UDTLayout.cpp:34
static bool classof(const Binary *v)
Definition: ObjectFile.h:336
symbol_iterator getSymbol() const
Definition: ObjectFile.h:512
symbol_iterator_range symbols() const
Definition: ObjectFile.h:284
virtual void moveSectionNext(DataRefImpl &Sec) const =0
iterator_range< relocation_iterator > relocations() const
Definition: ObjectFile.h:130
virtual bool isBerkeleyText(DataRefImpl Sec) const
Definition: ObjectFile.cpp:80
virtual bool isSectionData(DataRefImpl Sec) const =0
uint64_t getCommonSymbolSize(DataRefImpl Symb) const
Definition: ObjectFile.h:274
This is a value type class that represents a single symbol in the list of symbols in the object file...
Definition: SymbolicFile.h:99
virtual section_iterator getRelocatedSection(DataRefImpl Sec) const
Definition: ObjectFile.cpp:88
uint64_t getAlignment() const
Get the alignment of this section as the actual value (not log 2).
Definition: ObjectFile.h:434
const SymbolRef * operator->() const
Definition: ObjectFile.h:188
virtual bool isSectionCompressed(DataRefImpl Sec) const =0
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
virtual Expected< section_iterator > getSymbolSection(DataRefImpl Symb) const =0
virtual bool isSectionVirtual(DataRefImpl Sec) const =0
virtual uint64_t getSectionSize(DataRefImpl Sec) const =0
virtual void getRelocationTypeName(DataRefImpl Rel, SmallVectorImpl< char > &Result) const =0
symbol_iterator(SymbolRef Sym)
Definition: ObjectFile.h:183
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:46
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
static FeatureBitset getFeatures(StringRef CPU, StringRef FS, ArrayRef< SubtargetFeatureKV > ProcDesc, ArrayRef< SubtargetFeatureKV > ProcFeatures)
bool isBerkeleyData() const
Whether this section will be placed in the data segment, according to the Berkeley size format...
Definition: ObjectFile.h:470
virtual uint64_t getRelocationType(DataRefImpl Rel) const =0
Unrecognized file.
Definition: Magic.h:23
DataRefImpl getRawDataRefImpl() const
Definition: ObjectFile.h:524
This is a value type class that represents a single section in the list of sections in the object fil...
Definition: ObjectFile.h:81
file_magic - An "enum class" enumeration of file types based on magic (the first N bytes of the file)...
Definition: Magic.h:21