31 #include <system_error>
34 using namespace object;
36 void ObjectFile::anchor() {}
48 return *
this == **SymSec;
66 return std::error_code();
74 return SectName ==
".llvmbc";
128 if (std::error_code EC = FileOrErr.
getError())
130 std::unique_ptr<MemoryBuffer> Buffer = std::move(FileOrErr.
get());
134 if (
Error Err = ObjOrErr.takeError())
135 return std::move(Err);
136 std::unique_ptr<ObjectFile> Obj = std::move(ObjOrErr.get());
static Expected< OwningBinary< ObjectFile > > createObjectFile(StringRef ObjectPath)
Create ObjectFile from path.
std::error_code getError() const
Represents either an error or a value T.
Microsoft cl.exe's intermediate code file.
ELF dynamically linked shared lib.
Windows compiled resource file (.res)
static ErrorOr< std::unique_ptr< COFFObjectFile > > createCOFFObjectFile(MemoryBufferRef Object)
virtual std::error_code getSectionName(DataRefImpl Sec, StringRef &Res) const =0
Error takeError()
Take ownership of the stored error.
virtual Expected< StringRef > getSymbolName(DataRefImpl Symb) const =0
Mach-O Preloaded Executable.
file_magic identify_magic(StringRef magic)
Identify the type of a binary file based on how magical it is.
The Mach-O dynamic linker.
Tagged union holding either a T or a Error.
ELF Relocatable object file.
content_iterator< SectionRef > section_iterator
bool containsSymbol(SymbolRef S) const
Mach-O dSYM companion file.
virtual uint32_t getSymbolFlags(DataRefImpl Symb) const =0
The instances of the Type class are immutable: once they are created, they are never changed...
Error errorCodeToError(std::error_code EC)
Helper for converting an std::error_code to a Error.
Expected< T > errorOrToExpected(ErrorOr< T > &&EO)
Convert an ErrorOr<T> to an Expected<T>.
void consumeError(Error Err)
Consume a Error without doing anything.
static Expected< std::unique_ptr< WasmObjectFile > > createWasmObjectFile(MemoryBufferRef Object)
std::error_code printSymbolName(raw_ostream &OS, DataRefImpl Symb) const override
Mach-O dynlinked shared lib.
static Expected< std::unique_ptr< MachOObjectFile > > createMachOObjectFile(MemoryBufferRef Object, uint32_t UniversalCputype=0, uint32_t UniversalIndex=0)
StringRef getBuffer() const
virtual section_iterator getRelocatedSection(DataRefImpl Sec) const
This is a value type class that represents a single symbol in the list of symbols in the object file...
static ErrorOr< std::unique_ptr< ObjectFile > > createELFObjectFile(MemoryBufferRef Object)
Expected< section_iterator > getSection() const
Get section this symbol is defined in reference to.
llvm_unreachable("Unknown RegBank!")
static std::vector< std::string > Flags
uint64_t getSymbolValue(DataRefImpl Symb) const
virtual uint64_t getSymbolValueImpl(DataRefImpl Symb) const =0
uint64_t getCommonSymbolSize(DataRefImpl Symb) const
Provides ErrorOr<T> smart pointer.
static ErrorOr< std::unique_ptr< MemoryBuffer > > getFile(const Twine &Filename, int64_t FileSize=-1, bool RequiresNullTerminator=true, bool IsVolatile=false)
Open the specified file as a MemoryBuffer, returning a new MemoryBuffer if successful, otherwise returning null.
virtual bool isSectionBitcode(DataRefImpl Sec) const
Lightweight error class with error context and mandatory checking.
This class implements an extremely fast bulk output stream that can only output to a stream...
StringRef - Represent a constant reference to a string, i.e.
std::error_code errorToErrorCode(Error Err)
Helper for converting an ECError to a std::error_code.
file_magic - An "enum class" enumeration of file types based on magic (the first N bytes of the file)...
virtual uint32_t getSymbolAlignment(DataRefImpl Symb) const