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