X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=blobdiff_plain;f=include%2Fllvm-c%2FObject.h;h=a2980e89fe3dff8202aab4a5383c3e19327938e9;hp=91dc274267c35bcf9d3075fa8aeb46bbbba63e01;hb=67f5e4f21efd6c8e8ced7916b2407b81f117440a;hpb=ca7eb3e171f63de3cfc1020d86375ce11d356194 diff --git a/include/llvm-c/Object.h b/include/llvm-c/Object.h index 91dc274267c..a2980e89fe3 100644 --- a/include/llvm-c/Object.h +++ b/include/llvm-c/Object.h @@ -19,19 +19,25 @@ #ifndef LLVM_C_OBJECT_H #define LLVM_C_OBJECT_H -#include "llvm-c/Core.h" +#include "llvm-c/Types.h" #include "llvm/Config/llvm-config.h" #ifdef __cplusplus -#include "llvm/Object/ObjectFile.h" - extern "C" { #endif +/** + * @defgroup LLVMCObject Object file reading and writing + * @ingroup LLVMC + * + * @{ + */ + // Opaque type wrappers typedef struct LLVMOpaqueObjectFile *LLVMObjectFileRef; typedef struct LLVMOpaqueSectionIterator *LLVMSectionIteratorRef; typedef struct LLVMOpaqueSymbolIterator *LLVMSymbolIteratorRef; +typedef struct LLVMOpaqueRelocationIterator *LLVMRelocationIteratorRef; // ObjectFile creation LLVMObjectFileRef LLVMCreateObjectFile(LLVMMemoryBufferRef MemBuf); @@ -61,48 +67,34 @@ uint64_t LLVMGetSectionAddress(LLVMSectionIteratorRef SI); LLVMBool LLVMGetSectionContainsSymbol(LLVMSectionIteratorRef SI, LLVMSymbolIteratorRef Sym); +// Section Relocation iterators +LLVMRelocationIteratorRef LLVMGetRelocations(LLVMSectionIteratorRef Section); +void LLVMDisposeRelocationIterator(LLVMRelocationIteratorRef RI); +LLVMBool LLVMIsRelocationIteratorAtEnd(LLVMSectionIteratorRef Section, + LLVMRelocationIteratorRef RI); +void LLVMMoveToNextRelocation(LLVMRelocationIteratorRef RI); + + // SymbolRef accessors const char *LLVMGetSymbolName(LLVMSymbolIteratorRef SI); uint64_t LLVMGetSymbolAddress(LLVMSymbolIteratorRef SI); -uint64_t LLVMGetSymbolOffset(LLVMSymbolIteratorRef SI); uint64_t LLVMGetSymbolSize(LLVMSymbolIteratorRef SI); -#ifdef __cplusplus -} +// RelocationRef accessors +uint64_t LLVMGetRelocationOffset(LLVMRelocationIteratorRef RI); +LLVMSymbolIteratorRef LLVMGetRelocationSymbol(LLVMRelocationIteratorRef RI); +uint64_t LLVMGetRelocationType(LLVMRelocationIteratorRef RI); +// NOTE: Caller takes ownership of returned string of the two +// following functions. +const char *LLVMGetRelocationTypeName(LLVMRelocationIteratorRef RI); +const char *LLVMGetRelocationValueString(LLVMRelocationIteratorRef RI); -namespace llvm { - namespace object { - inline ObjectFile *unwrap(LLVMObjectFileRef OF) { - return reinterpret_cast(OF); - } - - inline LLVMObjectFileRef wrap(const ObjectFile *OF) { - return reinterpret_cast(const_cast(OF)); - } - - inline section_iterator *unwrap(LLVMSectionIteratorRef SI) { - return reinterpret_cast(SI); - } - - inline LLVMSectionIteratorRef - wrap(const section_iterator *SI) { - return reinterpret_cast - (const_cast(SI)); - } - - inline symbol_iterator *unwrap(LLVMSymbolIteratorRef SI) { - return reinterpret_cast(SI); - } - - inline LLVMSymbolIteratorRef - wrap(const symbol_iterator *SI) { - return reinterpret_cast - (const_cast(SI)); - } - } -} +/** + * @} + */ +#ifdef __cplusplus +} #endif /* defined(__cplusplus) */ #endif -