20 using namespace object;
63 std::unique_ptr<MemoryBuffer> Buf(
unwrap(MemBuf));
66 std::unique_ptr<ObjectFile> Obj;
112 *
unwrap(Sect) = *SecOrErr;
145 return (*
unwrap(SI))->getSize();
150 if (std::error_code ec = (*
unwrap(SI))->getContents(ret))
156 return (*
unwrap(SI))->getAddress();
176 return (*
unwrap(SI) == (*
unwrap(Section))->relocation_end()) ? 1 : 0;
210 return (*
unwrap(SI))->getCommonSize();
215 return (*
unwrap(RI))->getOffset();
224 return (*
unwrap(RI))->getType();
231 char *str =
static_cast<char*
>(malloc(ret.
size()));
232 std::copy(ret.
begin(), ret.
end(), str);
static Expected< OwningBinary< ObjectFile > > createObjectFile(StringRef ObjectPath)
Create ObjectFile from path.
uint64_t LLVMGetSectionAddress(LLVMSectionIteratorRef SI)
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
struct LLVMOpaqueMemoryBuffer * LLVMMemoryBufferRef
LLVM uses a polymorphic type hierarchy which C cannot represent, therefore parameters must be passed ...
void logAllUnhandledErrors(Error E, raw_ostream &OS, Twine ErrorBanner)
Log all errors (if any) in E to OS.
LLVMBool LLVMGetSectionContainsSymbol(LLVMSectionIteratorRef SI, LLVMSymbolIteratorRef Sym)
StringRef getTypeName()
We provide a function which tries to compute the (demangled) name of a type statically.
This class is the base class for all object file types.
LLVMObjectFileRef LLVMCreateObjectFile(LLVMMemoryBufferRef MemBuf)
Error takeError()
Take ownership of the stored error.
const char * LLVMGetSectionContents(LLVMSectionIteratorRef SI)
virtual basic_symbol_iterator symbol_begin() const =0
Attribute unwrap(LLVMAttributeRef Attr)
LLVMBool LLVMIsRelocationIteratorAtEnd(LLVMSectionIteratorRef Section, LLVMRelocationIteratorRef SI)
static StringRef getName(Value *V)
Tagged union holding either a T or a Error.
void LLVMDisposeSymbolIterator(LLVMSymbolIteratorRef SI)
Expected< const typename ELFT::Shdr * > getSection(typename ELFT::ShdrRange Sections, uint32_t Index)
void LLVMMoveToContainingSection(LLVMSectionIteratorRef Sect, LLVMSymbolIteratorRef Sym)
struct LLVMOpaqueSectionIterator * LLVMSectionIteratorRef
void LLVMDisposeSectionIterator(LLVMSectionIteratorRef SI)
Expected< const typename ELFT::Sym * > getSymbol(typename ELFT::SymRange Symbols, uint32_t Index)
void LLVMMoveToNextRelocation(LLVMRelocationIteratorRef SI)
content_iterator< SectionRef > section_iterator
LLVMSymbolIteratorRef LLVMGetRelocationSymbol(LLVMRelocationIteratorRef RI)
uint64_t LLVMGetSectionSize(LLVMSectionIteratorRef SI)
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator begin()
struct LLVMOpaqueSymbolIterator * LLVMSymbolIteratorRef
struct LLVMOpaqueObjectFile * LLVMObjectFileRef
virtual basic_symbol_iterator symbol_end() const =0
LLVMBool LLVMIsSectionIteratorAtEnd(LLVMObjectFileRef OF, LLVMSectionIteratorRef SI)
content_iterator< RelocationRef > relocation_iterator
void consumeError(Error Err)
Consume a Error without doing anything.
LLVMSymbolIteratorRef LLVMGetSymbols(LLVMObjectFileRef OF)
LLVMRelocationIteratorRef LLVMGetRelocations(LLVMSectionIteratorRef Section)
const char * LLVMGetSectionName(LLVMSectionIteratorRef SI)
const char * LLVMGetSymbolName(LLVMSymbolIteratorRef SI)
virtual section_iterator section_begin() const =0
reference get()
Returns a reference to the stored T value.
void LLVMDisposeRelocationIterator(LLVMRelocationIteratorRef SI)
LLVMSectionIteratorRef LLVMGetSections(LLVMObjectFileRef OF)
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator end()
LLVMAttributeRef wrap(Attribute Attr)
void LLVMMoveToNextSymbol(LLVMSymbolIteratorRef SI)
virtual section_iterator section_end() const =0
uint64_t LLVMGetSymbolAddress(LLVMSymbolIteratorRef SI)
const char * LLVMGetRelocationTypeName(LLVMRelocationIteratorRef RI)
LLVM_ATTRIBUTE_ALWAYS_INLINE size_type size() const
struct LLVMOpaqueRelocationIterator * LLVMRelocationIteratorRef
uint64_t LLVMGetRelocationOffset(LLVMRelocationIteratorRef RI)
uint64_t LLVMGetRelocationType(LLVMRelocationIteratorRef RI)
void LLVMDisposeObjectFile(LLVMObjectFileRef ObjectFile)
A raw_ostream that writes to an std::string.
LLVMBool LLVMIsSymbolIteratorAtEnd(LLVMObjectFileRef OF, LLVMSymbolIteratorRef SI)
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
uint64_t LLVMGetSymbolSize(LLVMSymbolIteratorRef SI)
StringRef - Represent a constant reference to a string, i.e.
const char * LLVMGetRelocationValueString(LLVMRelocationIteratorRef RI)
void LLVMMoveToNextSection(LLVMSectionIteratorRef SI)