20 using namespace object;
23 return reinterpret_cast<OwningBinary<ObjectFile> *
>(OF);
28 const_cast<OwningBinary<ObjectFile> *
>(OF));
63 std::unique_ptr<MemoryBuffer> Buf(
unwrap(MemBuf));
66 std::unique_ptr<ObjectFile> Obj;
70 auto *
Ret =
new OwningBinary<ObjectFile>(std::move(ObjOrErr.
get()), std::move(Buf));
80 OwningBinary<ObjectFile> *
OB =
unwrap(OF);
91 OwningBinary<ObjectFile> *
OB =
unwrap(OF);
92 return (*
unwrap(SI) == OB->getBinary()->section_end()) ? 1 : 0;
101 if (std::error_code ec = (*
unwrap(Sym))->getSection(*
unwrap(Sect)))
107 OwningBinary<ObjectFile> *
OB =
unwrap(OF);
118 OwningBinary<ObjectFile> *
OB =
unwrap(OF);
119 return (*
unwrap(SI) == OB->getBinary()->symbol_end()) ? 1 : 0;
135 return (*
unwrap(SI))->getSize();
140 if (std::error_code ec = (*
unwrap(SI))->getContents(ret))
146 return (*
unwrap(SI))->getAddress();
166 return (*
unwrap(SI) == (*
unwrap(Section))->relocation_end()) ? 1 : 0;
177 if (std::error_code EC = Ret.
getError())
184 if (std::error_code EC = Ret.
getError())
190 return (*
unwrap(SI))->getCommonSize();
195 return (*
unwrap(RI))->getOffset();
204 return (*
unwrap(RI))->getType();
210 (*
unwrap(RI))->getTypeName(ret);
211 char *str =
static_cast<char*
>(malloc(ret.
size()));
212 std::copy(ret.
begin(), ret.
end(), str);
std::error_code getError() const
Represents either an error or a value T.
uint64_t LLVMGetSectionAddress(LLVMSectionIteratorRef SI)
struct LLVMOpaqueMemoryBuffer * LLVMMemoryBufferRef
Used to pass regions of memory through LLVM interfaces.
LLVMBool LLVMGetSectionContainsSymbol(LLVMSectionIteratorRef SI, LLVMSymbolIteratorRef Sym)
This class is the base class for all object file types.
LLVMObjectFileRef LLVMCreateObjectFile(LLVMMemoryBufferRef MemBuf)
const char * LLVMGetSectionContents(LLVMSectionIteratorRef SI)
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(const char *reason, bool gen_crash_diag=true)
Reports a serious error, calling any installed error handler.
LLVMBool LLVMIsRelocationIteratorAtEnd(LLVMSectionIteratorRef Section, LLVMRelocationIteratorRef SI)
static StringRef getName(Value *V)
void LLVMDisposeSymbolIterator(LLVMSymbolIteratorRef SI)
void LLVMMoveToContainingSection(LLVMSectionIteratorRef Sect, LLVMSymbolIteratorRef Sym)
LLVMTargetDataRef wrap(const DataLayout *P)
struct LLVMOpaqueSectionIterator * LLVMSectionIteratorRef
const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
void LLVMDisposeSectionIterator(LLVMSectionIteratorRef SI)
void LLVMMoveToNextRelocation(LLVMRelocationIteratorRef SI)
content_iterator< SectionRef > section_iterator
LLVMSymbolIteratorRef LLVMGetRelocationSymbol(LLVMRelocationIteratorRef RI)
DataLayout * unwrap(LLVMTargetDataRef P)
uint64_t LLVMGetSectionSize(LLVMSectionIteratorRef SI)
struct LLVMOpaqueSymbolIterator * LLVMSymbolIteratorRef
struct LLVMOpaqueObjectFile * LLVMObjectFileRef
LLVMBool LLVMIsSectionIteratorAtEnd(LLVMObjectFileRef OF, LLVMSectionIteratorRef SI)
content_iterator< RelocationRef > relocation_iterator
LLVMSymbolIteratorRef LLVMGetSymbols(LLVMObjectFileRef OF)
LLVMRelocationIteratorRef LLVMGetRelocations(LLVMSectionIteratorRef Section)
const char * LLVMGetSectionName(LLVMSectionIteratorRef SI)
const char * LLVMGetSymbolName(LLVMSymbolIteratorRef SI)
void LLVMDisposeRelocationIterator(LLVMRelocationIteratorRef SI)
LLVMSectionIteratorRef LLVMGetSections(LLVMObjectFileRef OF)
void LLVMMoveToNextSymbol(LLVMSymbolIteratorRef SI)
uint64_t LLVMGetSymbolAddress(LLVMSymbolIteratorRef SI)
const char * LLVMGetRelocationTypeName(LLVMRelocationIteratorRef RI)
struct LLVMOpaqueRelocationIterator * LLVMRelocationIteratorRef
uint64_t LLVMGetRelocationOffset(LLVMRelocationIteratorRef RI)
uint64_t LLVMGetRelocationType(LLVMRelocationIteratorRef RI)
void LLVMDisposeObjectFile(LLVMObjectFileRef ObjectFile)
LLVMBool LLVMIsSymbolIteratorAtEnd(LLVMObjectFileRef OF, LLVMSymbolIteratorRef SI)
static ErrorOr< OwningBinary< ObjectFile > > createObjectFile(StringRef ObjectPath)
Create ObjectFile from path.
uint64_t LLVMGetSymbolSize(LLVMSymbolIteratorRef SI)
StringRef - Represent a constant reference to a string, i.e.
const char * LLVMGetRelocationValueString(LLVMRelocationIteratorRef RI)
void LLVMMoveToNextSection(LLVMSectionIteratorRef SI)