LLVM  9.0.0svn
Typedefs | Enumerations | Functions
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
 Deprecated: Use LLVMBinaryRef instead. More...
 

Enumerations

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

Functions

LLVMBinaryRef LLVMCreateBinary (LLVMMemoryBufferRef MemBuf, LLVMContextRef Context, char **ErrorMessage)
 Create a binary file from the given memory buffer. More...
 
void LLVMDisposeBinary (LLVMBinaryRef BR)
 Dispose of a binary file. More...
 
LLVMMemoryBufferRef LLVMBinaryCopyMemoryBuffer (LLVMBinaryRef BR)
 Retrieves a copy of the memory buffer associated with this object file. More...
 
LLVMBinaryType LLVMBinaryGetType (LLVMBinaryRef BR)
 Retrieve the specific type of a binary. More...
 
LLVMBinaryRef LLVMMachOUniversalBinaryCopyObjectForArch (LLVMBinaryRef BR, const char *Arch, size_t ArchLen, char **ErrorMessage)
 
LLVMSectionIteratorRef LLVMObjectFileCopySectionIterator (LLVMBinaryRef BR)
 Retrieve a copy of the section iterator for this object file. More...
 
LLVMBool LLVMObjectFileIsSectionIteratorAtEnd (LLVMBinaryRef BR, LLVMSectionIteratorRef SI)
 Returns whether the given section iterator is at the end. More...
 
LLVMSymbolIteratorRef LLVMObjectFileCopySymbolIterator (LLVMBinaryRef BR)
 Retrieve a copy of the symbol iterator for this object file. More...
 
LLVMBool LLVMObjectFileIsSymbolIteratorAtEnd (LLVMBinaryRef BR, LLVMSymbolIteratorRef SI)
 Returns whether the given symbol iterator is at the end. More...
 
void LLVMDisposeSectionIterator (LLVMSectionIteratorRef SI)
 
void LLVMMoveToNextSection (LLVMSectionIteratorRef SI)
 
void LLVMMoveToContainingSection (LLVMSectionIteratorRef Sect, LLVMSymbolIteratorRef Sym)
 
void LLVMDisposeSymbolIterator (LLVMSymbolIteratorRef SI)
 
void LLVMMoveToNextSymbol (LLVMSymbolIteratorRef SI)
 
const charLLVMGetSectionName (LLVMSectionIteratorRef SI)
 
uint64_t LLVMGetSectionSize (LLVMSectionIteratorRef SI)
 
const charLLVMGetSectionContents (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 charLLVMGetSymbolName (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 charLLVMGetRelocationTypeName (LLVMRelocationIteratorRef RI)
 
const charLLVMGetRelocationValueString (LLVMRelocationIteratorRef RI)
 
LLVMObjectFileRef LLVMCreateObjectFile (LLVMMemoryBufferRef MemBuf)
 Deprecated: Use LLVMCreateBinary instead. More...
 
void LLVMDisposeObjectFile (LLVMObjectFileRef ObjectFile)
 Deprecated: Use LLVMDisposeBinary instead. More...
 
LLVMSectionIteratorRef LLVMGetSections (LLVMObjectFileRef ObjectFile)
 Deprecated: Use LLVMObjectFileCopySectionIterator instead. More...
 
LLVMBool LLVMIsSectionIteratorAtEnd (LLVMObjectFileRef ObjectFile, LLVMSectionIteratorRef SI)
 Deprecated: Use LLVMObjectFileIsSectionIteratorAtEnd instead. More...
 
LLVMSymbolIteratorRef LLVMGetSymbols (LLVMObjectFileRef ObjectFile)
 Deprecated: Use LLVMObjectFileCopySymbolIterator instead. More...
 
LLVMBool LLVMIsSymbolIteratorAtEnd (LLVMObjectFileRef ObjectFile, LLVMSymbolIteratorRef SI)
 Deprecated: Use LLVMObjectFileIsSymbolIteratorAtEnd instead. More...
 

Detailed Description

Typedef Documentation

◆ LLVMObjectFileRef

typedef struct LLVMOpaqueObjectFile* LLVMObjectFileRef

Deprecated: Use LLVMBinaryRef instead.

Definition at line 204 of file Object.h.

◆ LLVMRelocationIteratorRef

typedef struct LLVMOpaqueRelocationIterator* LLVMRelocationIteratorRef

Definition at line 39 of file Object.h.

◆ LLVMSectionIteratorRef

typedef struct LLVMOpaqueSectionIterator* LLVMSectionIteratorRef

Definition at line 37 of file Object.h.

◆ LLVMSymbolIteratorRef

typedef struct LLVMOpaqueSymbolIterator* LLVMSymbolIteratorRef

Definition at line 38 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.

Definition at line 41 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

Definition at line 78 of file Object.cpp.

References llvm::MemoryBuffer::getMemBuffer(), llvm::release, llvm::unwrap(), and llvm::wrap().

◆ LLVMBinaryGetType()

LLVMBinaryType LLVMBinaryGetType ( LLVMBinaryRef  BR)

◆ 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

Definition at line 64 of file Object.cpp.

References llvm::c_str(), llvm::object::createBinary(), llvm::Expected< T >::get(), llvm::Expected< T >::takeError(), llvm::toString(), llvm::unwrap(), and llvm::wrap().

◆ LLVMCreateObjectFile()

LLVMObjectFileRef LLVMCreateObjectFile ( LLVMMemoryBufferRef  MemBuf)

◆ 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.

Definition at line 85 of file Object.cpp.

References llvm::unwrap().

◆ LLVMDisposeObjectFile()

void LLVMDisposeObjectFile ( LLVMObjectFileRef  ObjectFile)

Deprecated: Use LLVMDisposeBinary instead.

Definition at line 193 of file Object.cpp.

References llvm::unwrap().

◆ LLVMDisposeRelocationIterator()

void LLVMDisposeRelocationIterator ( LLVMRelocationIteratorRef  RI)

Definition at line 286 of file Object.cpp.

References llvm::unwrap().

◆ LLVMDisposeSectionIterator()

void LLVMDisposeSectionIterator ( LLVMSectionIteratorRef  SI)

Definition at line 204 of file Object.cpp.

References llvm::unwrap().

◆ LLVMDisposeSymbolIterator()

void LLVMDisposeSymbolIterator ( LLVMSymbolIteratorRef  SI)

Definition at line 238 of file Object.cpp.

References llvm::unwrap().

◆ LLVMGetRelocationOffset()

uint64_t LLVMGetRelocationOffset ( LLVMRelocationIteratorRef  RI)

Definition at line 330 of file Object.cpp.

References llvm::unwrap().

◆ LLVMGetRelocations()

LLVMRelocationIteratorRef LLVMGetRelocations ( LLVMSectionIteratorRef  Section)

Definition at line 281 of file Object.cpp.

References SI, llvm::unwrap(), and llvm::wrap().

◆ LLVMGetRelocationSymbol()

LLVMSymbolIteratorRef LLVMGetRelocationSymbol ( LLVMRelocationIteratorRef  RI)

Definition at line 334 of file Object.cpp.

References llvm::object::getSymbol(), llvm::unwrap(), and llvm::wrap().

◆ LLVMGetRelocationType()

uint64_t LLVMGetRelocationType ( LLVMRelocationIteratorRef  RI)

Definition at line 339 of file Object.cpp.

References llvm::unwrap().

◆ LLVMGetRelocationTypeName()

const char* LLVMGetRelocationTypeName ( LLVMRelocationIteratorRef  RI)

◆ LLVMGetRelocationValueString()

const char* LLVMGetRelocationValueString ( LLVMRelocationIteratorRef  RI)

Definition at line 353 of file Object.cpp.

◆ LLVMGetSectionAddress()

uint64_t LLVMGetSectionAddress ( LLVMSectionIteratorRef  SI)

Definition at line 271 of file Object.cpp.

References llvm::unwrap().

◆ LLVMGetSectionContainsSymbol()

LLVMBool LLVMGetSectionContainsSymbol ( LLVMSectionIteratorRef  SI,
LLVMSymbolIteratorRef  Sym 
)

Definition at line 275 of file Object.cpp.

References llvm::unwrap().

◆ LLVMGetSectionContents()

const char* LLVMGetSectionContents ( LLVMSectionIteratorRef  SI)

Definition at line 264 of file Object.cpp.

References E, llvm::report_fatal_error(), and llvm::unwrap().

◆ LLVMGetSectionName()

const char* LLVMGetSectionName ( LLVMSectionIteratorRef  SI)

◆ LLVMGetSections()

LLVMSectionIteratorRef LLVMGetSections ( LLVMObjectFileRef  ObjectFile)

Deprecated: Use LLVMObjectFileCopySectionIterator instead.

Definition at line 198 of file Object.cpp.

References llvm::X86II::OB, SI, llvm::unwrap(), and llvm::wrap().

◆ LLVMGetSectionSize()

uint64_t LLVMGetSectionSize ( LLVMSectionIteratorRef  SI)

Definition at line 260 of file Object.cpp.

References llvm::unwrap().

◆ LLVMGetSymbolAddress()

uint64_t LLVMGetSymbolAddress ( LLVMSymbolIteratorRef  SI)

◆ LLVMGetSymbolName()

const char* LLVMGetSymbolName ( LLVMSymbolIteratorRef  SI)

◆ LLVMGetSymbols()

LLVMSymbolIteratorRef LLVMGetSymbols ( LLVMObjectFileRef  ObjectFile)

Deprecated: Use LLVMObjectFileCopySymbolIterator instead.

Definition at line 232 of file Object.cpp.

References llvm::X86II::OB, SI, llvm::unwrap(), and llvm::wrap().

◆ LLVMGetSymbolSize()

uint64_t LLVMGetSymbolSize ( LLVMSymbolIteratorRef  SI)

Definition at line 325 of file Object.cpp.

References llvm::unwrap().

◆ LLVMIsRelocationIteratorAtEnd()

LLVMBool LLVMIsRelocationIteratorAtEnd ( LLVMSectionIteratorRef  Section,
LLVMRelocationIteratorRef  RI 
)

Definition at line 290 of file Object.cpp.

References llvm::unwrap().

◆ LLVMIsSectionIteratorAtEnd()

LLVMBool LLVMIsSectionIteratorAtEnd ( LLVMObjectFileRef  ObjectFile,
LLVMSectionIteratorRef  SI 
)

Deprecated: Use LLVMObjectFileIsSectionIteratorAtEnd instead.

Definition at line 208 of file Object.cpp.

References llvm::X86II::OB, and llvm::unwrap().

◆ LLVMIsSymbolIteratorAtEnd()

LLVMBool LLVMIsSymbolIteratorAtEnd ( LLVMObjectFileRef  ObjectFile,
LLVMSymbolIteratorRef  SI 
)

Deprecated: Use LLVMObjectFileIsSymbolIteratorAtEnd instead.

Definition at line 242 of file Object.cpp.

References llvm::X86II::OB, and llvm::unwrap().

◆ LLVMMachOUniversalBinaryCopyObjectForArch()

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

Definition at line 135 of file Object.cpp.

References llvm::c_str(), llvm::toString(), llvm::unwrap(), and llvm::wrap().

◆ LLVMMoveToContainingSection()

void LLVMMoveToContainingSection ( LLVMSectionIteratorRef  Sect,
LLVMSymbolIteratorRef  Sym 
)

◆ LLVMMoveToNextRelocation()

void LLVMMoveToNextRelocation ( LLVMRelocationIteratorRef  RI)

Definition at line 295 of file Object.cpp.

References llvm::unwrap().

◆ LLVMMoveToNextSection()

void LLVMMoveToNextSection ( LLVMSectionIteratorRef  SI)

Definition at line 214 of file Object.cpp.

References llvm::unwrap().

◆ LLVMMoveToNextSymbol()

void LLVMMoveToNextSymbol ( LLVMSymbolIteratorRef  SI)

Definition at line 248 of file Object.cpp.

References llvm::unwrap().

◆ 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()

Definition at line 149 of file Object.cpp.

References llvm::unwrap(), and llvm::wrap().

◆ 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()

Definition at line 163 of file Object.cpp.

References llvm::unwrap(), and llvm::wrap().

◆ LLVMObjectFileIsSectionIteratorAtEnd()

LLVMBool LLVMObjectFileIsSectionIteratorAtEnd ( LLVMBinaryRef  BR,
LLVMSectionIteratorRef  SI 
)

Returns whether the given section iterator is at the end.

See also
llvm::object::section_end

Definition at line 157 of file Object.cpp.

References llvm::unwrap().

◆ LLVMObjectFileIsSymbolIteratorAtEnd()

LLVMBool LLVMObjectFileIsSymbolIteratorAtEnd ( LLVMBinaryRef  BR,
LLVMSymbolIteratorRef  SI 
)

Returns whether the given symbol iterator is at the end.

See also
llvm::object::symbol_end

Definition at line 171 of file Object.cpp.

References llvm::unwrap().