1*9880d681SAndroid Build Coastguard Worker /*===-- llvm-c/Object.h - Object Lib C Iface --------------------*- C++ -*-===*/ 2*9880d681SAndroid Build Coastguard Worker /* */ 3*9880d681SAndroid Build Coastguard Worker /* The LLVM Compiler Infrastructure */ 4*9880d681SAndroid Build Coastguard Worker /* */ 5*9880d681SAndroid Build Coastguard Worker /* This file is distributed under the University of Illinois Open Source */ 6*9880d681SAndroid Build Coastguard Worker /* License. See LICENSE.TXT for details. */ 7*9880d681SAndroid Build Coastguard Worker /* */ 8*9880d681SAndroid Build Coastguard Worker /*===----------------------------------------------------------------------===*/ 9*9880d681SAndroid Build Coastguard Worker /* */ 10*9880d681SAndroid Build Coastguard Worker /* This header declares the C interface to libLLVMObject.a, which */ 11*9880d681SAndroid Build Coastguard Worker /* implements object file reading and writing. */ 12*9880d681SAndroid Build Coastguard Worker /* */ 13*9880d681SAndroid Build Coastguard Worker /* Many exotic languages can interoperate with C code but have a harder time */ 14*9880d681SAndroid Build Coastguard Worker /* with C++ due to name mangling. So in addition to C, this interface enables */ 15*9880d681SAndroid Build Coastguard Worker /* tools written in such languages. */ 16*9880d681SAndroid Build Coastguard Worker /* */ 17*9880d681SAndroid Build Coastguard Worker /*===----------------------------------------------------------------------===*/ 18*9880d681SAndroid Build Coastguard Worker 19*9880d681SAndroid Build Coastguard Worker #ifndef LLVM_C_OBJECT_H 20*9880d681SAndroid Build Coastguard Worker #define LLVM_C_OBJECT_H 21*9880d681SAndroid Build Coastguard Worker 22*9880d681SAndroid Build Coastguard Worker #include "llvm-c/Types.h" 23*9880d681SAndroid Build Coastguard Worker #include "llvm/Config/llvm-config.h" 24*9880d681SAndroid Build Coastguard Worker 25*9880d681SAndroid Build Coastguard Worker #ifdef __cplusplus 26*9880d681SAndroid Build Coastguard Worker extern "C" { 27*9880d681SAndroid Build Coastguard Worker #endif 28*9880d681SAndroid Build Coastguard Worker 29*9880d681SAndroid Build Coastguard Worker /** 30*9880d681SAndroid Build Coastguard Worker * @defgroup LLVMCObject Object file reading and writing 31*9880d681SAndroid Build Coastguard Worker * @ingroup LLVMC 32*9880d681SAndroid Build Coastguard Worker * 33*9880d681SAndroid Build Coastguard Worker * @{ 34*9880d681SAndroid Build Coastguard Worker */ 35*9880d681SAndroid Build Coastguard Worker 36*9880d681SAndroid Build Coastguard Worker // Opaque type wrappers 37*9880d681SAndroid Build Coastguard Worker typedef struct LLVMOpaqueObjectFile *LLVMObjectFileRef; 38*9880d681SAndroid Build Coastguard Worker typedef struct LLVMOpaqueSectionIterator *LLVMSectionIteratorRef; 39*9880d681SAndroid Build Coastguard Worker typedef struct LLVMOpaqueSymbolIterator *LLVMSymbolIteratorRef; 40*9880d681SAndroid Build Coastguard Worker typedef struct LLVMOpaqueRelocationIterator *LLVMRelocationIteratorRef; 41*9880d681SAndroid Build Coastguard Worker 42*9880d681SAndroid Build Coastguard Worker // ObjectFile creation 43*9880d681SAndroid Build Coastguard Worker LLVMObjectFileRef LLVMCreateObjectFile(LLVMMemoryBufferRef MemBuf); 44*9880d681SAndroid Build Coastguard Worker void LLVMDisposeObjectFile(LLVMObjectFileRef ObjectFile); 45*9880d681SAndroid Build Coastguard Worker 46*9880d681SAndroid Build Coastguard Worker // ObjectFile Section iterators 47*9880d681SAndroid Build Coastguard Worker LLVMSectionIteratorRef LLVMGetSections(LLVMObjectFileRef ObjectFile); 48*9880d681SAndroid Build Coastguard Worker void LLVMDisposeSectionIterator(LLVMSectionIteratorRef SI); 49*9880d681SAndroid Build Coastguard Worker LLVMBool LLVMIsSectionIteratorAtEnd(LLVMObjectFileRef ObjectFile, 50*9880d681SAndroid Build Coastguard Worker LLVMSectionIteratorRef SI); 51*9880d681SAndroid Build Coastguard Worker void LLVMMoveToNextSection(LLVMSectionIteratorRef SI); 52*9880d681SAndroid Build Coastguard Worker void LLVMMoveToContainingSection(LLVMSectionIteratorRef Sect, 53*9880d681SAndroid Build Coastguard Worker LLVMSymbolIteratorRef Sym); 54*9880d681SAndroid Build Coastguard Worker 55*9880d681SAndroid Build Coastguard Worker // ObjectFile Symbol iterators 56*9880d681SAndroid Build Coastguard Worker LLVMSymbolIteratorRef LLVMGetSymbols(LLVMObjectFileRef ObjectFile); 57*9880d681SAndroid Build Coastguard Worker void LLVMDisposeSymbolIterator(LLVMSymbolIteratorRef SI); 58*9880d681SAndroid Build Coastguard Worker LLVMBool LLVMIsSymbolIteratorAtEnd(LLVMObjectFileRef ObjectFile, 59*9880d681SAndroid Build Coastguard Worker LLVMSymbolIteratorRef SI); 60*9880d681SAndroid Build Coastguard Worker void LLVMMoveToNextSymbol(LLVMSymbolIteratorRef SI); 61*9880d681SAndroid Build Coastguard Worker 62*9880d681SAndroid Build Coastguard Worker // SectionRef accessors 63*9880d681SAndroid Build Coastguard Worker const char *LLVMGetSectionName(LLVMSectionIteratorRef SI); 64*9880d681SAndroid Build Coastguard Worker uint64_t LLVMGetSectionSize(LLVMSectionIteratorRef SI); 65*9880d681SAndroid Build Coastguard Worker const char *LLVMGetSectionContents(LLVMSectionIteratorRef SI); 66*9880d681SAndroid Build Coastguard Worker uint64_t LLVMGetSectionAddress(LLVMSectionIteratorRef SI); 67*9880d681SAndroid Build Coastguard Worker LLVMBool LLVMGetSectionContainsSymbol(LLVMSectionIteratorRef SI, 68*9880d681SAndroid Build Coastguard Worker LLVMSymbolIteratorRef Sym); 69*9880d681SAndroid Build Coastguard Worker 70*9880d681SAndroid Build Coastguard Worker // Section Relocation iterators 71*9880d681SAndroid Build Coastguard Worker LLVMRelocationIteratorRef LLVMGetRelocations(LLVMSectionIteratorRef Section); 72*9880d681SAndroid Build Coastguard Worker void LLVMDisposeRelocationIterator(LLVMRelocationIteratorRef RI); 73*9880d681SAndroid Build Coastguard Worker LLVMBool LLVMIsRelocationIteratorAtEnd(LLVMSectionIteratorRef Section, 74*9880d681SAndroid Build Coastguard Worker LLVMRelocationIteratorRef RI); 75*9880d681SAndroid Build Coastguard Worker void LLVMMoveToNextRelocation(LLVMRelocationIteratorRef RI); 76*9880d681SAndroid Build Coastguard Worker 77*9880d681SAndroid Build Coastguard Worker 78*9880d681SAndroid Build Coastguard Worker // SymbolRef accessors 79*9880d681SAndroid Build Coastguard Worker const char *LLVMGetSymbolName(LLVMSymbolIteratorRef SI); 80*9880d681SAndroid Build Coastguard Worker uint64_t LLVMGetSymbolAddress(LLVMSymbolIteratorRef SI); 81*9880d681SAndroid Build Coastguard Worker uint64_t LLVMGetSymbolSize(LLVMSymbolIteratorRef SI); 82*9880d681SAndroid Build Coastguard Worker 83*9880d681SAndroid Build Coastguard Worker // RelocationRef accessors 84*9880d681SAndroid Build Coastguard Worker uint64_t LLVMGetRelocationOffset(LLVMRelocationIteratorRef RI); 85*9880d681SAndroid Build Coastguard Worker LLVMSymbolIteratorRef LLVMGetRelocationSymbol(LLVMRelocationIteratorRef RI); 86*9880d681SAndroid Build Coastguard Worker uint64_t LLVMGetRelocationType(LLVMRelocationIteratorRef RI); 87*9880d681SAndroid Build Coastguard Worker // NOTE: Caller takes ownership of returned string of the two 88*9880d681SAndroid Build Coastguard Worker // following functions. 89*9880d681SAndroid Build Coastguard Worker const char *LLVMGetRelocationTypeName(LLVMRelocationIteratorRef RI); 90*9880d681SAndroid Build Coastguard Worker const char *LLVMGetRelocationValueString(LLVMRelocationIteratorRef RI); 91*9880d681SAndroid Build Coastguard Worker 92*9880d681SAndroid Build Coastguard Worker /** 93*9880d681SAndroid Build Coastguard Worker * @} 94*9880d681SAndroid Build Coastguard Worker */ 95*9880d681SAndroid Build Coastguard Worker 96*9880d681SAndroid Build Coastguard Worker #ifdef __cplusplus 97*9880d681SAndroid Build Coastguard Worker } 98*9880d681SAndroid Build Coastguard Worker #endif /* defined(__cplusplus) */ 99*9880d681SAndroid Build Coastguard Worker 100*9880d681SAndroid Build Coastguard Worker #endif 101