2011-04-03 22:34:07 +00:00
|
|
|
/*===-- llvm-c/Object.h - Object Lib C Iface --------------------*- C++ -*-===*/
|
|
|
|
/* */
|
|
|
|
/* The LLVM Compiler Infrastructure */
|
|
|
|
/* */
|
|
|
|
/* This file is distributed under the University of Illinois Open Source */
|
|
|
|
/* License. See LICENSE.TXT for details. */
|
|
|
|
/* */
|
|
|
|
/*===----------------------------------------------------------------------===*/
|
|
|
|
/* */
|
|
|
|
/* This header declares the C interface to libLLVMObject.a, which */
|
|
|
|
/* implements object file reading and writing. */
|
|
|
|
/* */
|
|
|
|
/* Many exotic languages can interoperate with C code but have a harder time */
|
|
|
|
/* with C++ due to name mangling. So in addition to C, this interface enables */
|
|
|
|
/* tools written in such languages. */
|
|
|
|
/* */
|
|
|
|
/*===----------------------------------------------------------------------===*/
|
|
|
|
|
|
|
|
#ifndef LLVM_C_OBJECT_H
|
|
|
|
#define LLVM_C_OBJECT_H
|
|
|
|
|
|
|
|
#include "llvm-c/Core.h"
|
|
|
|
#include "llvm/Config/llvm-config.h"
|
|
|
|
|
2013-04-04 17:40:53 +00:00
|
|
|
#ifdef __cplusplus
|
2011-04-03 22:34:07 +00:00
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* @defgroup LLVMCObject Object file reading and writing
|
|
|
|
* @ingroup LLVMC
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2011-10-21 17:50:59 +00:00
|
|
|
// Opaque type wrappers
|
2011-04-03 22:34:07 +00:00
|
|
|
typedef struct LLVMOpaqueObjectFile *LLVMObjectFileRef;
|
|
|
|
typedef struct LLVMOpaqueSectionIterator *LLVMSectionIteratorRef;
|
2011-10-21 20:28:19 +00:00
|
|
|
typedef struct LLVMOpaqueSymbolIterator *LLVMSymbolIteratorRef;
|
2011-10-27 17:15:47 +00:00
|
|
|
typedef struct LLVMOpaqueRelocationIterator *LLVMRelocationIteratorRef;
|
2011-04-03 22:34:07 +00:00
|
|
|
|
2011-10-21 17:50:59 +00:00
|
|
|
// ObjectFile creation
|
2011-04-03 22:34:07 +00:00
|
|
|
LLVMObjectFileRef LLVMCreateObjectFile(LLVMMemoryBufferRef MemBuf);
|
|
|
|
void LLVMDisposeObjectFile(LLVMObjectFileRef ObjectFile);
|
|
|
|
|
2011-10-21 17:50:59 +00:00
|
|
|
// ObjectFile Section iterators
|
2011-04-03 22:34:07 +00:00
|
|
|
LLVMSectionIteratorRef LLVMGetSections(LLVMObjectFileRef ObjectFile);
|
|
|
|
void LLVMDisposeSectionIterator(LLVMSectionIteratorRef SI);
|
|
|
|
LLVMBool LLVMIsSectionIteratorAtEnd(LLVMObjectFileRef ObjectFile,
|
|
|
|
LLVMSectionIteratorRef SI);
|
|
|
|
void LLVMMoveToNextSection(LLVMSectionIteratorRef SI);
|
2011-10-21 18:21:22 +00:00
|
|
|
void LLVMMoveToContainingSection(LLVMSectionIteratorRef Sect,
|
|
|
|
LLVMSymbolIteratorRef Sym);
|
2011-10-21 17:50:59 +00:00
|
|
|
|
|
|
|
// ObjectFile Symbol iterators
|
|
|
|
LLVMSymbolIteratorRef LLVMGetSymbols(LLVMObjectFileRef ObjectFile);
|
|
|
|
void LLVMDisposeSymbolIterator(LLVMSymbolIteratorRef SI);
|
|
|
|
LLVMBool LLVMIsSymbolIteratorAtEnd(LLVMObjectFileRef ObjectFile,
|
|
|
|
LLVMSymbolIteratorRef SI);
|
|
|
|
void LLVMMoveToNextSymbol(LLVMSymbolIteratorRef SI);
|
|
|
|
|
|
|
|
// SectionRef accessors
|
2011-04-03 22:34:07 +00:00
|
|
|
const char *LLVMGetSectionName(LLVMSectionIteratorRef SI);
|
|
|
|
uint64_t LLVMGetSectionSize(LLVMSectionIteratorRef SI);
|
|
|
|
const char *LLVMGetSectionContents(LLVMSectionIteratorRef SI);
|
2011-10-21 17:50:59 +00:00
|
|
|
uint64_t LLVMGetSectionAddress(LLVMSectionIteratorRef SI);
|
2011-10-21 20:35:58 +00:00
|
|
|
LLVMBool LLVMGetSectionContainsSymbol(LLVMSectionIteratorRef SI,
|
2011-10-21 17:50:59 +00:00
|
|
|
LLVMSymbolIteratorRef Sym);
|
2011-04-03 22:34:07 +00:00
|
|
|
|
2011-10-27 17:15:47 +00:00
|
|
|
// Section Relocation iterators
|
|
|
|
LLVMRelocationIteratorRef LLVMGetRelocations(LLVMSectionIteratorRef Section);
|
|
|
|
void LLVMDisposeRelocationIterator(LLVMRelocationIteratorRef RI);
|
|
|
|
LLVMBool LLVMIsRelocationIteratorAtEnd(LLVMSectionIteratorRef Section,
|
|
|
|
LLVMRelocationIteratorRef RI);
|
|
|
|
void LLVMMoveToNextRelocation(LLVMRelocationIteratorRef RI);
|
|
|
|
|
|
|
|
|
2011-10-21 17:50:59 +00:00
|
|
|
// SymbolRef accessors
|
|
|
|
const char *LLVMGetSymbolName(LLVMSymbolIteratorRef SI);
|
|
|
|
uint64_t LLVMGetSymbolAddress(LLVMSymbolIteratorRef SI);
|
|
|
|
uint64_t LLVMGetSymbolSize(LLVMSymbolIteratorRef SI);
|
2011-04-03 22:34:07 +00:00
|
|
|
|
2011-10-27 17:32:36 +00:00
|
|
|
// RelocationRef accessors
|
|
|
|
uint64_t LLVMGetRelocationAddress(LLVMRelocationIteratorRef RI);
|
2011-11-29 17:40:10 +00:00
|
|
|
uint64_t LLVMGetRelocationOffset(LLVMRelocationIteratorRef RI);
|
2011-10-27 17:32:36 +00:00
|
|
|
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);
|
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
2011-10-27 17:32:36 +00:00
|
|
|
|
2011-04-03 22:34:07 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
2013-04-04 17:40:53 +00:00
|
|
|
#endif /* defined(__cplusplus) */
|
2011-04-03 22:34:07 +00:00
|
|
|
|
|
|
|
#endif
|