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