Go to the documentation of this file.
13 #ifndef LLVM_OBJECT_OBJECTFILE_H
14 #define LLVM_OBJECT_OBJECTFILE_H
35 class SubtargetFeatures;
40 class MachOObjectFile;
44 class symbol_iterator;
153 return std::tie(
LHS.SectionIndex,
LHS.Address) <
154 std::tie(
RHS.SectionIndex,
RHS.Address);
159 return std::tie(
LHS.SectionIndex,
LHS.Address) ==
160 std::tie(
RHS.SectionIndex,
RHS.Address);
229 virtual void anchor();
307 if (!SymbolFlagsOrErr)
315 return std::vector<SectionRef>();
371 bool InitContent =
true);
433 return cast<ObjectFile>(
O);
439 : SectionPimpl(SectionP)
440 , OwningObject(Owner) {}
443 return OwningObject ==
Other.OwningObject &&
444 SectionPimpl ==
Other.SectionPimpl;
448 return !(*
this ==
Other);
453 return SectionPimpl <
Other.SectionPimpl;
481 return StringRef(
reinterpret_cast<const char *
>(Res->data()), Res->size());
552 : RelocationPimpl(RelocationP)
553 , OwningObject(Owner) {}
556 return RelocationPimpl ==
Other.RelocationPimpl;
580 return RelocationPimpl;
599 TS.
p = (uintptr_t)-1;
610 #endif // LLVM_OBJECT_OBJECTFILE_H
bool operator<(const SectionRef &Other) const
symbol_iterator getSymbol() const
void getTypeName(SmallVectorImpl< char > &Result) const
Get a string that represents the type of this relocation.
@ unknown
Unrecognized file.
const char * getBufferStart() const
This is an optimization pass for GlobalISel generic memory operations.
virtual uint8_t getBytesInAddress() const =0
The number of bytes used to represent an address in this object file format.
Expected< uint64_t > getValue() const
Return the value of the symbol depending on the object this can be an offset or a virtual address.
virtual Expected< StringRef > getSectionName(DataRefImpl Sec) const =0
bool isData() const
Whether this section contains data, not instructions.
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
bool containsSymbol(SymbolRef S) const
file_magic - An "enum class" enumeration of file types based on magic (the first N bytes of the file)...
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
virtual uint64_t getSectionAddress(DataRefImpl Sec) const =0
static Expected< std::unique_ptr< WasmObjectFile > > createWasmObjectFile(MemoryBufferRef Object)
virtual symbol_iterator getRelocationSymbol(DataRefImpl Rel) const =0
DataRefImpl getRawDataRefImpl() const
virtual Expected< uint64_t > getSymbolAddress(DataRefImpl Symb) const =0
static Expected< std::unique_ptr< MachOObjectFile > > createMachOObjectFile(MemoryBufferRef Object, uint32_t UniversalCputype=0, uint32_t UniversalIndex=0)
Expected< StringRef > getName() const
Triple - Helper class for working with autoconf configuration names.
virtual Expected< SubtargetFeatures > getFeatures() const =0
Expected< uint64_t > getSymbolValue(DataRefImpl Symb) const
virtual void setARMSubArch(Triple &TheTriple) const
bool isBerkeleyText() const
Whether this section will be placed in the text segment, according to the Berkeley size format.
The instances of the Type class are immutable: once they are created, they are never changed.
const SymbolRef * operator->() const
SymbolRef(const BasicSymbolRef &B)
Align valueOrOne() const
For convenience, returns a valid alignment or 1 if undefined.
static Expected< const T * > getObject(MemoryBufferRef M, const void *Ptr, const uint64_t Size=sizeof(T))
static Expected< std::unique_ptr< COFFObjectFile > > createCOFFObjectFile(MemoryBufferRef Object)
bool isBSS() const
Whether this section contains BSS uninitialized data.
virtual Triple::ArchType getArch() const =0
static bool classof(const Binary *v)
Tagged union holding either a T or a Error.
virtual section_iterator section_begin() const =0
uint64_t getCommonSize() const
virtual llvm::binaryformat::Swift5ReflectionSectionKind mapReflectionSectionNameToEnumValue(StringRef SectionName) const
uint32_t getAlignment() const
Get the alignment of this symbol as the actual value (not log 2).
Align getAlignment() const
Get the alignment of this section.
static object::SectionRef getEmptyKey()
symbol_iterator_range symbols() const
uint64_t getCommonSymbolSize(DataRefImpl Symb) const
virtual bool isDebugSection(DataRefImpl Sec) const
virtual basic_symbol_iterator symbol_end() const =0
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
virtual Expected< uint32_t > getSymbolFlags(DataRefImpl Symb) const =0
An information struct used to provide DenseMap with the various necessary components for a given valu...
virtual bool isSectionText(DataRefImpl Sec) const =0
virtual bool isSectionData(DataRefImpl Sec) const =0
virtual bool isBerkeleyText(DataRefImpl Sec) const
virtual void getRelocationTypeName(DataRefImpl Rel, SmallVectorImpl< char > &Result) const =0
virtual bool isRelocatableObject() const =0
True if this is a relocatable object (.o/.obj).
const SymbolRef & operator*() const
virtual section_iterator section_end() const =0
DataRefImpl getRawDataRefImpl() const
iterator_range< relocation_iterator > relocations() const
virtual void moveSectionNext(DataRefImpl &Sec) const =0
virtual bool isSectionCompressed(DataRefImpl Sec) const =0
Error errorCodeToError(std::error_code EC)
Helper for converting an std::error_code to a Error.
This is a value type class that represents a single symbol in the list of symbols in the object file.
virtual StringRef getFileFormatName() const =0
const content_type & operator*() const
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
This class implements an extremely fast bulk output stream that can only output to a stream.
virtual uint64_t getSymbolValueImpl(DataRefImpl Symb) const =0
virtual Expected< section_iterator > getSymbolSection(DataRefImpl Symb) const =0
bool isBerkeleyData() const
Whether this section will be placed in the data segment, according to the Berkeley size format.
static Expected< std::unique_ptr< ObjectFile > > createELFObjectFile(MemoryBufferRef Object, bool InitContent=true)
virtual uint64_t getSectionSize(DataRefImpl Sec) const =0
iterator_range< section_iterator > section_iterator_range
const ObjectFile * getObject() const
This struct is a compact representation of a valid (non-zero power of two) alignment.
virtual bool isSectionVirtual(DataRefImpl Sec) const =0
DataRefImpl getRawDataRefImpl() const
virtual uint64_t getRelocationType(DataRefImpl Rel) const =0
FileType
Defines the file type this file represents.
const SymbolicFile * getObject() const
This is a value type class that represents a single section in the list of sections in the object fil...
raw_ostream & operator<<(raw_ostream &OS, const SectionedAddress &Addr)
virtual bool isBerkeleyData(DataRefImpl Sec) const
Expected< section_iterator > getSection() const
Get section this symbol is defined in reference to.
bar al al movzbl eax ret Missed when stored in a memory object
const static uint64_t UndefSection
bool isDebugSection() const
Whether this section is a debug section.
static Expected< OwningBinary< ObjectFile > > createObjectFile(StringRef ObjectPath)
Error printSymbolName(raw_ostream &OS, DataRefImpl Symb) const override
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
virtual Expected< StringRef > getSymbolName(DataRefImpl Symb) const =0
Expected< section_iterator > getRelocatedSection() const
Returns the related section if this section contains relocations.
const uint8_t * base() const
Expected< StringRef > getContents() const
static Expected< std::unique_ptr< ObjectFile > > createXCOFFObjectFile(MemoryBufferRef Object, unsigned FileType)
Triple makeTriple() const
Create a triple from the data in this object file.
uint64_t getOffset() const
bool operator!=(const SectionRef &Other) const
StringRef - Represent a constant reference to a string, i.e.
This class is the base class for all object file types.
virtual uint64_t getRelocationOffset(DataRefImpl Rel) const =0
virtual Expected< section_iterator > getRelocatedSection(DataRefImpl Sec) const
virtual Expected< ArrayRef< uint8_t > > getSectionContents(DataRefImpl Sec) const =0
const ObjectFile * getObject() const
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
virtual basic_symbol_iterator symbol_begin() const =0
virtual bool isSectionBSS(DataRefImpl Sec) const =0
iterator_range< symbol_iterator > symbol_iterator_range
uint64_t getAddress() const
virtual relocation_iterator section_rel_end(DataRefImpl Sec) const =0
bool operator<(const SectionedAddress &LHS, const SectionedAddress &RHS)
virtual uint32_t getSymbolAlignment(DataRefImpl Symb) const
bool isText() const
Whether this section contains instructions.
virtual bool isSectionStripped(DataRefImpl Sec) const
virtual relocation_iterator section_rel_begin(DataRefImpl Sec) const =0
relocation_iterator relocation_end() const
Lightweight error class with error context and mandatory checking.
symbol_iterator(SymbolRef Sym)
struct llvm::object::DataRefImpl::@337 d
bool operator==(const SectionedAddress &LHS, const SectionedAddress &RHS)
virtual uint64_t getSectionIndex(DataRefImpl Sec) const =0
bool operator==(const SectionRef &Other) const
virtual StringRef mapDebugSectionName(StringRef Name) const
Maps a debug section name to a standard DWARF section name.
Error takeError()
Take ownership of the stored error.
std::optional< std::vector< StOtherPiece > > Other
virtual uint64_t getCommonSymbolSizeImpl(DataRefImpl Symb) const =0
hash_code hash_combine(const Ts &...args)
Combine values into a single hash_code.
virtual Expected< SymbolRef::Type > getSymbolType(DataRefImpl Symb) const =0
bool isReflectionSectionStrippable(llvm::binaryformat::Swift5ReflectionSectionKind ReflectionSectionKind) const
True if the reflection section can be stripped by the linker.
Expected< SymbolRef::Type > getType() const
uint64_t getIndex() const
A range adaptor for a pair of iterators.
section_iterator_range sections() const
bool isCompressed() const
bool operator==(const RelocationRef &Other) const
static object::SectionRef getTombstoneKey()
This is a value type class that represents a single symbol in the list of symbols in the object file.
virtual bool hasDebugInfo() const
virtual bool isSectionBitcode(DataRefImpl Sec) const
This is a value type class that represents a single relocation in the list of relocations in the obje...
Expected< StringRef > getName() const
virtual void moveRelocationNext(DataRefImpl &Rel) const =0
virtual Expected< uint64_t > getStartAddress() const
const ObjectFile * getObject() const
virtual std::vector< SectionRef > dynamic_relocation_sections() const
virtual std::optional< StringRef > tryGetCPUName() const
static unsigned getHashValue(const object::SectionRef &Sec)
symbol_iterator(const basic_symbol_iterator &B)
Expected< uint64_t > getAddress() const
Returns the symbol virtual address (i.e.
virtual uint64_t getSectionAlignment(DataRefImpl Sec) const =0
static Expected< std::unique_ptr< ObjectFile > > createObjectFile(MemoryBufferRef Object)
relocation_iterator relocation_begin() const
static bool isEqual(const object::SectionRef &A, const object::SectionRef &B)