Project Alice
Loading...
Searching...
No Matches
Object.h
Go to the documentation of this file.
1/*===-- llvm-c/Object.h - Object Lib C Iface --------------------*- C++ -*-===*/
2/* */
3/* Part of the LLVM Project, under the Apache License v2.0 with LLVM */
4/* Exceptions. */
5/* See https://llvm.org/LICENSE.txt for license information. */
6/* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */
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/ExternC.h"
23#include "llvm-c/Types.h"
25
27
35// Opaque type wrappers
36typedef struct LLVMOpaqueSectionIterator *LLVMSectionIteratorRef;
37typedef struct LLVMOpaqueSymbolIterator *LLVMSymbolIteratorRef;
38typedef struct LLVMOpaqueRelocationIterator *LLVMRelocationIteratorRef;
39
40typedef enum {
59
77 LLVMContextRef Context,
78 char **ErrorMessage);
79
87
98
105
106/*
107 * For a Mach-O universal binary file, retrieves the object file corresponding
108 * to the given architecture if it is present as a slice.
109 *
110 * If NULL is returned, the \p ErrorMessage parameter is populated with the
111 * error's description. It is then the caller's responsibility to free this
112 * message by calling \c LLVMDisposeMessage.
113 *
114 * It is the responsiblity of the caller to free the returned object file by
115 * calling \c LLVMDisposeBinary.
116 */
118 const char *Arch,
119 size_t ArchLen,
120 char **ErrorMessage);
121
134
142
155
163
165
169
170// ObjectFile Symbol iterators
173
174// SectionRef accessors
181
182// Section Relocation iterators
188
189
190// SymbolRef accessors
194
195// RelocationRef accessors
199// NOTE: Caller takes ownership of returned string of the two
200// following functions.
203
205typedef struct LLVMOpaqueObjectFile *LLVMObjectFileRef;
206
209
212
215
219
222
231
232#endif
#define LLVM_C_EXTERN_C_BEGIN
Definition: ExternC.h:35
#define LLVM_C_EXTERN_C_END
Definition: ExternC.h:36
uint64_t LLVMGetRelocationType(LLVMRelocationIteratorRef RI)
LLVMObjectFileRef LLVMCreateObjectFile(LLVMMemoryBufferRef MemBuf)
LLVMSymbolIteratorRef LLVMObjectFileCopySymbolIterator(LLVMBinaryRef BR)
LLVMBool LLVMIsRelocationIteratorAtEnd(LLVMSectionIteratorRef Section, LLVMRelocationIteratorRef RI)
struct LLVMOpaqueSymbolIterator * LLVMSymbolIteratorRef
Definition: Object.h:37
void LLVMMoveToNextRelocation(LLVMRelocationIteratorRef RI)
void LLVMDisposeSectionIterator(LLVMSectionIteratorRef SI)
const char * LLVMGetSectionContents(LLVMSectionIteratorRef SI)
const char * LLVMGetSectionName(LLVMSectionIteratorRef SI)
uint64_t LLVMGetRelocationOffset(LLVMRelocationIteratorRef RI)
uint64_t LLVMGetSymbolSize(LLVMSymbolIteratorRef SI)
const char * LLVMGetRelocationTypeName(LLVMRelocationIteratorRef RI)
LLVMBool LLVMIsSectionIteratorAtEnd(LLVMObjectFileRef ObjectFile, LLVMSectionIteratorRef SI)
uint64_t LLVMGetSectionSize(LLVMSectionIteratorRef SI)
void LLVMDisposeSymbolIterator(LLVMSymbolIteratorRef SI)
LLVMSymbolIteratorRef LLVMGetSymbols(LLVMObjectFileRef ObjectFile)
LLVMSectionIteratorRef LLVMGetSections(LLVMObjectFileRef ObjectFile)
uint64_t LLVMGetSectionAddress(LLVMSectionIteratorRef SI)
LLVMBool LLVMIsSymbolIteratorAtEnd(LLVMObjectFileRef ObjectFile, LLVMSymbolIteratorRef SI)
LLVMBinaryType LLVMBinaryGetType(LLVMBinaryRef BR)
LLVMBool LLVMObjectFileIsSectionIteratorAtEnd(LLVMBinaryRef BR, LLVMSectionIteratorRef SI)
void LLVMMoveToNextSymbol(LLVMSymbolIteratorRef SI)
LLVMRelocationIteratorRef LLVMGetRelocations(LLVMSectionIteratorRef Section)
struct LLVMOpaqueSectionIterator * LLVMSectionIteratorRef
Definition: Object.h:36
LLVMBinaryRef LLVMMachOUniversalBinaryCopyObjectForArch(LLVMBinaryRef BR, const char *Arch, size_t ArchLen, char **ErrorMessage)
LLVMBinaryType
Definition: Object.h:40
void LLVMMoveToContainingSection(LLVMSectionIteratorRef Sect, LLVMSymbolIteratorRef Sym)
void LLVMDisposeBinary(LLVMBinaryRef BR)
LLVMSectionIteratorRef LLVMObjectFileCopySectionIterator(LLVMBinaryRef BR)
void LLVMDisposeRelocationIterator(LLVMRelocationIteratorRef RI)
LLVMBinaryRef LLVMCreateBinary(LLVMMemoryBufferRef MemBuf, LLVMContextRef Context, char **ErrorMessage)
LLVMSymbolIteratorRef LLVMGetRelocationSymbol(LLVMRelocationIteratorRef RI)
void LLVMDisposeObjectFile(LLVMObjectFileRef ObjectFile)
LLVMBool LLVMObjectFileIsSymbolIteratorAtEnd(LLVMBinaryRef BR, LLVMSymbolIteratorRef SI)
const char * LLVMGetSymbolName(LLVMSymbolIteratorRef SI)
struct LLVMOpaqueRelocationIterator * LLVMRelocationIteratorRef
Definition: Object.h:38
struct LLVMOpaqueObjectFile * LLVMObjectFileRef
Definition: Object.h:205
LLVMMemoryBufferRef LLVMBinaryCopyMemoryBuffer(LLVMBinaryRef BR)
void LLVMMoveToNextSection(LLVMSectionIteratorRef SI)
LLVMBool LLVMGetSectionContainsSymbol(LLVMSectionIteratorRef SI, LLVMSymbolIteratorRef Sym)
const char * LLVMGetRelocationValueString(LLVMRelocationIteratorRef RI)
uint64_t LLVMGetSymbolAddress(LLVMSymbolIteratorRef SI)
@ LLVMBinaryTypeIR
Definition: Object.h:44
@ LLVMBinaryTypeELF64B
Definition: Object.h:50
@ LLVMBinaryTypeArchive
Definition: Object.h:41
@ LLVMBinaryTypeMachO32B
Definition: Object.h:52
@ LLVMBinaryTypeWasm
Definition: Object.h:55
@ LLVMBinaryTypeELF64L
Definition: Object.h:49
@ LLVMBinaryTypeWinRes
Definition: Object.h:45
@ LLVMBinaryTypeMachOUniversalBinary
Definition: Object.h:42
@ LLVMBinaryTypeMachO64B
Definition: Object.h:54
@ LLVMBinaryTypeCOFF
Definition: Object.h:46
@ LLVMBinaryTypeCOFFImportFile
Definition: Object.h:43
@ LLVMBinaryTypeELF32B
Definition: Object.h:48
@ LLVMBinaryTypeELF32L
Definition: Object.h:47
@ LLVMBinaryTypeMachO32L
Definition: Object.h:51
@ LLVMBinaryTypeMachO64L
Definition: Object.h:53
@ LLVMBinaryTypeOffload
Definition: Object.h:56
int LLVMBool
Definition: Types.h:28
struct LLVMOpaqueBinary * LLVMBinaryRef
Definition: Types.h:170
struct LLVMOpaqueMemoryBuffer * LLVMMemoryBufferRef
Definition: Types.h:48
struct LLVMOpaqueContext * LLVMContextRef
Definition: Types.h:53
ulong uint64_t