Project Alice
Loading...
Searching...
No Matches
Object file reading and writing
Collaboration diagram for Object file reading and writing:

Typedefs

typedef struct LLVMOpaqueSectionIterator * LLVMSectionIteratorRef
 
typedef struct LLVMOpaqueSymbolIterator * LLVMSymbolIteratorRef
 
typedef struct LLVMOpaqueRelocationIterator * LLVMRelocationIteratorRef
 
typedef struct LLVMOpaqueObjectFile * LLVMObjectFileRef
 

Enumerations

enum  LLVMBinaryType {
  LLVMBinaryTypeArchive , LLVMBinaryTypeMachOUniversalBinary , LLVMBinaryTypeCOFFImportFile , LLVMBinaryTypeIR ,
  LLVMBinaryTypeWinRes , LLVMBinaryTypeCOFF , LLVMBinaryTypeELF32L , LLVMBinaryTypeELF32B ,
  LLVMBinaryTypeELF64L , LLVMBinaryTypeELF64B , LLVMBinaryTypeMachO32L , LLVMBinaryTypeMachO32B ,
  LLVMBinaryTypeMachO64L , LLVMBinaryTypeMachO64B , LLVMBinaryTypeWasm , LLVMBinaryTypeOffload
}
 

Functions

LLVMBinaryRef LLVMCreateBinary (LLVMMemoryBufferRef MemBuf, LLVMContextRef Context, char **ErrorMessage)
 
void LLVMDisposeBinary (LLVMBinaryRef BR)
 
LLVMMemoryBufferRef LLVMBinaryCopyMemoryBuffer (LLVMBinaryRef BR)
 
LLVMBinaryType LLVMBinaryGetType (LLVMBinaryRef BR)
 
LLVMBinaryRef LLVMMachOUniversalBinaryCopyObjectForArch (LLVMBinaryRef BR, const char *Arch, size_t ArchLen, char **ErrorMessage)
 
LLVMSectionIteratorRef LLVMObjectFileCopySectionIterator (LLVMBinaryRef BR)
 
LLVMBool LLVMObjectFileIsSectionIteratorAtEnd (LLVMBinaryRef BR, LLVMSectionIteratorRef SI)
 
LLVMSymbolIteratorRef LLVMObjectFileCopySymbolIterator (LLVMBinaryRef BR)
 
LLVMBool LLVMObjectFileIsSymbolIteratorAtEnd (LLVMBinaryRef BR, LLVMSymbolIteratorRef SI)
 
void LLVMDisposeSectionIterator (LLVMSectionIteratorRef SI)
 
void LLVMMoveToNextSection (LLVMSectionIteratorRef SI)
 
void LLVMMoveToContainingSection (LLVMSectionIteratorRef Sect, LLVMSymbolIteratorRef Sym)
 
void LLVMDisposeSymbolIterator (LLVMSymbolIteratorRef SI)
 
void LLVMMoveToNextSymbol (LLVMSymbolIteratorRef SI)
 
const char * LLVMGetSectionName (LLVMSectionIteratorRef SI)
 
uint64_t LLVMGetSectionSize (LLVMSectionIteratorRef SI)
 
const char * LLVMGetSectionContents (LLVMSectionIteratorRef SI)
 
uint64_t LLVMGetSectionAddress (LLVMSectionIteratorRef SI)
 
LLVMBool LLVMGetSectionContainsSymbol (LLVMSectionIteratorRef SI, LLVMSymbolIteratorRef Sym)
 
LLVMRelocationIteratorRef LLVMGetRelocations (LLVMSectionIteratorRef Section)
 
void LLVMDisposeRelocationIterator (LLVMRelocationIteratorRef RI)
 
LLVMBool LLVMIsRelocationIteratorAtEnd (LLVMSectionIteratorRef Section, LLVMRelocationIteratorRef RI)
 
void LLVMMoveToNextRelocation (LLVMRelocationIteratorRef RI)
 
const char * LLVMGetSymbolName (LLVMSymbolIteratorRef SI)
 
uint64_t LLVMGetSymbolAddress (LLVMSymbolIteratorRef SI)
 
uint64_t LLVMGetSymbolSize (LLVMSymbolIteratorRef SI)
 
uint64_t LLVMGetRelocationOffset (LLVMRelocationIteratorRef RI)
 
LLVMSymbolIteratorRef LLVMGetRelocationSymbol (LLVMRelocationIteratorRef RI)
 
uint64_t LLVMGetRelocationType (LLVMRelocationIteratorRef RI)
 
const char * LLVMGetRelocationTypeName (LLVMRelocationIteratorRef RI)
 
const char * LLVMGetRelocationValueString (LLVMRelocationIteratorRef RI)
 
LLVMObjectFileRef LLVMCreateObjectFile (LLVMMemoryBufferRef MemBuf)
 
void LLVMDisposeObjectFile (LLVMObjectFileRef ObjectFile)
 
LLVMSectionIteratorRef LLVMGetSections (LLVMObjectFileRef ObjectFile)
 
LLVMBool LLVMIsSectionIteratorAtEnd (LLVMObjectFileRef ObjectFile, LLVMSectionIteratorRef SI)
 
LLVMSymbolIteratorRef LLVMGetSymbols (LLVMObjectFileRef ObjectFile)
 
LLVMBool LLVMIsSymbolIteratorAtEnd (LLVMObjectFileRef ObjectFile, LLVMSymbolIteratorRef SI)
 

Detailed Description

Typedef Documentation

◆ LLVMObjectFileRef

typedef struct LLVMOpaqueObjectFile* LLVMObjectFileRef

Deprecated: Use LLVMBinaryRef instead.

Definition at line 205 of file Object.h.

◆ LLVMRelocationIteratorRef

typedef struct LLVMOpaqueRelocationIterator* LLVMRelocationIteratorRef

Definition at line 38 of file Object.h.

◆ LLVMSectionIteratorRef

typedef struct LLVMOpaqueSectionIterator* LLVMSectionIteratorRef

Definition at line 36 of file Object.h.

◆ LLVMSymbolIteratorRef

typedef struct LLVMOpaqueSymbolIterator* LLVMSymbolIteratorRef

Definition at line 37 of file Object.h.

Enumeration Type Documentation

◆ LLVMBinaryType

Enumerator
LLVMBinaryTypeArchive 

Archive file.

LLVMBinaryTypeMachOUniversalBinary 

Mach-O Universal Binary file.

LLVMBinaryTypeCOFFImportFile 

COFF Import file.

LLVMBinaryTypeIR 

LLVM IR.

LLVMBinaryTypeWinRes 

Windows resource (.res) file.

LLVMBinaryTypeCOFF 

COFF Object file.

LLVMBinaryTypeELF32L 

ELF 32-bit, little endian.

LLVMBinaryTypeELF32B 

ELF 32-bit, big endian.

LLVMBinaryTypeELF64L 

ELF 64-bit, little endian.

LLVMBinaryTypeELF64B 

ELF 64-bit, big endian.

LLVMBinaryTypeMachO32L 

MachO 32-bit, little endian.

LLVMBinaryTypeMachO32B 

MachO 32-bit, big endian.

LLVMBinaryTypeMachO64L 

MachO 64-bit, little endian.

LLVMBinaryTypeMachO64B 

MachO 64-bit, big endian.

LLVMBinaryTypeWasm 

Web Assembly.

LLVMBinaryTypeOffload 

Offloading fatbinary.

Definition at line 40 of file Object.h.

Function Documentation

◆ LLVMBinaryCopyMemoryBuffer()

LLVMMemoryBufferRef LLVMBinaryCopyMemoryBuffer ( LLVMBinaryRef  BR)

Retrieves a copy of the memory buffer associated with this object file.

The returned buffer is merely a shallow copy and does not own the actual backing buffer of the binary. Nevertheless, it is the responsibility of the caller to free it with LLVMDisposeMemoryBuffer.

See also
llvm::object::getMemoryBufferRef

◆ LLVMBinaryGetType()

LLVMBinaryType LLVMBinaryGetType ( LLVMBinaryRef  BR)

Retrieve the specific type of a binary.

See also
llvm::object::Binary::getType

◆ LLVMCreateBinary()

LLVMBinaryRef LLVMCreateBinary ( LLVMMemoryBufferRef  MemBuf,
LLVMContextRef  Context,
char **  ErrorMessage 
)

Create a binary file from the given memory buffer.

The exact type of the binary file will be inferred automatically, and the appropriate implementation selected. The context may be NULL except if the resulting file is an LLVM IR file.

The memory buffer is not consumed by this function. It is the responsibilty of the caller to free it with LLVMDisposeMemoryBuffer.

If NULL is returned, the ErrorMessage parameter is populated with the error's description. It is then the caller's responsibility to free this message by calling LLVMDisposeMessage.

See also
llvm::object::createBinary

◆ LLVMCreateObjectFile()

LLVMObjectFileRef LLVMCreateObjectFile ( LLVMMemoryBufferRef  MemBuf)

Deprecated: Use LLVMCreateBinary instead.

◆ LLVMDisposeBinary()

void LLVMDisposeBinary ( LLVMBinaryRef  BR)

Dispose of a binary file.

The binary file does not own its backing buffer. It is the responsibilty of the caller to free it with LLVMDisposeMemoryBuffer.

◆ LLVMDisposeObjectFile()

void LLVMDisposeObjectFile ( LLVMObjectFileRef  ObjectFile)

Deprecated: Use LLVMDisposeBinary instead.

◆ LLVMDisposeRelocationIterator()

void LLVMDisposeRelocationIterator ( LLVMRelocationIteratorRef  RI)

◆ LLVMDisposeSectionIterator()

void LLVMDisposeSectionIterator ( LLVMSectionIteratorRef  SI)

◆ LLVMDisposeSymbolIterator()

void LLVMDisposeSymbolIterator ( LLVMSymbolIteratorRef  SI)

◆ LLVMGetRelocationOffset()

uint64_t LLVMGetRelocationOffset ( LLVMRelocationIteratorRef  RI)

◆ LLVMGetRelocations()

LLVMRelocationIteratorRef LLVMGetRelocations ( LLVMSectionIteratorRef  Section)

◆ LLVMGetRelocationSymbol()

LLVMSymbolIteratorRef LLVMGetRelocationSymbol ( LLVMRelocationIteratorRef  RI)

◆ LLVMGetRelocationType()

uint64_t LLVMGetRelocationType ( LLVMRelocationIteratorRef  RI)

◆ LLVMGetRelocationTypeName()

const char * LLVMGetRelocationTypeName ( LLVMRelocationIteratorRef  RI)

◆ LLVMGetRelocationValueString()

const char * LLVMGetRelocationValueString ( LLVMRelocationIteratorRef  RI)

◆ LLVMGetSectionAddress()

uint64_t LLVMGetSectionAddress ( LLVMSectionIteratorRef  SI)

◆ LLVMGetSectionContainsSymbol()

LLVMBool LLVMGetSectionContainsSymbol ( LLVMSectionIteratorRef  SI,
LLVMSymbolIteratorRef  Sym 
)

◆ LLVMGetSectionContents()

const char * LLVMGetSectionContents ( LLVMSectionIteratorRef  SI)

◆ LLVMGetSectionName()

const char * LLVMGetSectionName ( LLVMSectionIteratorRef  SI)

◆ LLVMGetSections()

LLVMSectionIteratorRef LLVMGetSections ( LLVMObjectFileRef  ObjectFile)

Deprecated: Use LLVMObjectFileCopySectionIterator instead.

◆ LLVMGetSectionSize()

uint64_t LLVMGetSectionSize ( LLVMSectionIteratorRef  SI)

◆ LLVMGetSymbolAddress()

uint64_t LLVMGetSymbolAddress ( LLVMSymbolIteratorRef  SI)

◆ LLVMGetSymbolName()

const char * LLVMGetSymbolName ( LLVMSymbolIteratorRef  SI)

◆ LLVMGetSymbols()

LLVMSymbolIteratorRef LLVMGetSymbols ( LLVMObjectFileRef  ObjectFile)

Deprecated: Use LLVMObjectFileCopySymbolIterator instead.

◆ LLVMGetSymbolSize()

uint64_t LLVMGetSymbolSize ( LLVMSymbolIteratorRef  SI)

◆ LLVMIsRelocationIteratorAtEnd()

LLVMBool LLVMIsRelocationIteratorAtEnd ( LLVMSectionIteratorRef  Section,
LLVMRelocationIteratorRef  RI 
)

◆ LLVMIsSectionIteratorAtEnd()

LLVMBool LLVMIsSectionIteratorAtEnd ( LLVMObjectFileRef  ObjectFile,
LLVMSectionIteratorRef  SI 
)

Deprecated: Use LLVMObjectFileIsSectionIteratorAtEnd instead.

◆ LLVMIsSymbolIteratorAtEnd()

LLVMBool LLVMIsSymbolIteratorAtEnd ( LLVMObjectFileRef  ObjectFile,
LLVMSymbolIteratorRef  SI 
)

Deprecated: Use LLVMObjectFileIsSymbolIteratorAtEnd instead.

◆ LLVMMachOUniversalBinaryCopyObjectForArch()

LLVMBinaryRef LLVMMachOUniversalBinaryCopyObjectForArch ( LLVMBinaryRef  BR,
const char *  Arch,
size_t  ArchLen,
char **  ErrorMessage 
)

◆ LLVMMoveToContainingSection()

void LLVMMoveToContainingSection ( LLVMSectionIteratorRef  Sect,
LLVMSymbolIteratorRef  Sym 
)

◆ LLVMMoveToNextRelocation()

void LLVMMoveToNextRelocation ( LLVMRelocationIteratorRef  RI)

◆ LLVMMoveToNextSection()

void LLVMMoveToNextSection ( LLVMSectionIteratorRef  SI)

◆ LLVMMoveToNextSymbol()

void LLVMMoveToNextSymbol ( LLVMSymbolIteratorRef  SI)

◆ LLVMObjectFileCopySectionIterator()

LLVMSectionIteratorRef LLVMObjectFileCopySectionIterator ( LLVMBinaryRef  BR)

Retrieve a copy of the section iterator for this object file.

If there are no sections, the result is NULL.

The returned iterator is merely a shallow copy. Nevertheless, it is the responsibility of the caller to free it with LLVMDisposeSectionIterator.

See also
llvm::object::sections()

◆ LLVMObjectFileCopySymbolIterator()

LLVMSymbolIteratorRef LLVMObjectFileCopySymbolIterator ( LLVMBinaryRef  BR)

Retrieve a copy of the symbol iterator for this object file.

If there are no symbols, the result is NULL.

The returned iterator is merely a shallow copy. Nevertheless, it is the responsibility of the caller to free it with LLVMDisposeSymbolIterator.

See also
llvm::object::symbols()

◆ LLVMObjectFileIsSectionIteratorAtEnd()

LLVMBool LLVMObjectFileIsSectionIteratorAtEnd ( LLVMBinaryRef  BR,
LLVMSectionIteratorRef  SI 
)

Returns whether the given section iterator is at the end.

See also
llvm::object::section_end

◆ LLVMObjectFileIsSymbolIteratorAtEnd()

LLVMBool LLVMObjectFileIsSymbolIteratorAtEnd ( LLVMBinaryRef  BR,
LLVMSymbolIteratorRef  SI 
)

Returns whether the given symbol iterator is at the end.

See also
llvm::object::symbol_end