Go to the documentation of this file.
25 return reinterpret_cast<OwningBinary<ObjectFile> *
>(OF);
30 const_cast<OwningBinary<ObjectFile> *
>(OF));
44 return reinterpret_cast<symbol_iterator*
>(
SI);
50 (
const_cast<symbol_iterator*
>(
SI));
67 char **ErrorMessage) {
76 return wrap(ObjOrErr.
get().release());
80 auto Buf =
unwrap(
BR)->getMemoryBufferRef();
82 Buf.getBuffer(), Buf.getBufferIdentifier(),
91 class BinaryTypeMapper final :
public Binary {
97 case ID_MachOUniversalBinary:
99 case ID_COFFImportFile:
127 case ID_StartObjects:
135 return BinaryTypeMapper::mapBinaryTypeToLLVMBinaryType(
unwrap(
BR)->
getType());
141 char **ErrorMessage) {
142 auto universal = cast<MachOUniversalBinary>(
unwrap(
BR));
144 universal->getMachOObjectForArch({Arch, ArchLen}));
149 return wrap(ObjOrErr.
get().release());
153 auto OF = cast<ObjectFile>(
unwrap(
BR));
154 auto sections = OF->sections();
155 if (sections.begin() == sections.end())
162 auto OF = cast<ObjectFile>(
unwrap(
BR));
163 return (*
unwrap(
SI) == OF->section_end()) ? 1 : 0;
167 auto OF = cast<ObjectFile>(
unwrap(
BR));
176 auto OF = cast<ObjectFile>(
unwrap(
BR));
177 return (*
unwrap(
SI) == OF->symbol_end()) ? 1 : 0;
182 std::unique_ptr<MemoryBuffer> Buf(
unwrap(MemBuf));
185 std::unique_ptr<ObjectFile> Obj;
197 delete unwrap(ObjectFile);
202 OwningBinary<ObjectFile> *
OB =
unwrap(OF);
213 OwningBinary<ObjectFile> *
OB =
unwrap(OF);
214 return (*
unwrap(
SI) ==
OB->getBinary()->section_end()) ? 1 : 0;
230 *
unwrap(Sect) = *SecOrErr;
235 OwningBinary<ObjectFile> *
OB =
unwrap(OF);
236 symbol_iterator
SI =
OB->getBinary()->symbol_begin();
237 return wrap(
new symbol_iterator(
SI));
246 OwningBinary<ObjectFile> *
OB =
unwrap(OF);
247 return (*
unwrap(
SI) ==
OB->getBinary()->symbol_end()) ? 1 : 0;
259 return NameOrErr->data();
294 return (*
unwrap(
SI) == (*
unwrap(Section))->relocation_end()) ? 1 : 0;
326 return (*
unwrap(
SI))->getCommonSize();
331 return (*
unwrap(RI))->getOffset();
335 symbol_iterator
ret = (*
unwrap(RI))->getSymbol();
336 return wrap(
new symbol_iterator(
ret));
340 return (*
unwrap(RI))->getType();
LLVMBool LLVMGetSectionContainsSymbol(LLVMSectionIteratorRef SI, LLVMSymbolIteratorRef Sym)
static StringRef getName(Value *V)
This is an optimization pass for GlobalISel generic memory operations.
struct LLVMOpaqueContext * LLVMContextRef
The top-level container for all LLVM global data.
uint64_t LLVMGetRelocationOffset(LLVMRelocationIteratorRef RI)
LLVMObjectFileRef LLVMCreateObjectFile(LLVMMemoryBufferRef MemBuf)
Deprecated: Use LLVMCreateBinary instead.
void LLVMMoveToNextSection(LLVMSectionIteratorRef SI)
A raw_ostream that writes to an std::string.
@ LLVMBinaryTypeOffload
Offloading fatbinary.
LLVMBool LLVMIsSymbolIteratorAtEnd(LLVMObjectFileRef OF, LLVMSymbolIteratorRef SI)
Deprecated: Use LLVMObjectFileIsSymbolIteratorAtEnd instead.
uint64_t LLVMGetSymbolSize(LLVMSymbolIteratorRef SI)
void LLVMDisposeSectionIterator(LLVMSectionIteratorRef SI)
content_iterator< RelocationRef > relocation_iterator
Expected< const typename ELFT::Shdr * > getSection(typename ELFT::ShdrRange Sections, uint32_t Index)
OutputIt copy(R &&Range, OutputIt Out)
to esp esp setne al movzbw ax esp setg cl movzbw cx cmove cx cl jne LBB1_2 esp ret(also really horrible code on ppc). This is due to the expand code for 64-bit compares. GCC produces multiple branches
Tagged union holding either a T or a Error.
void LLVMDisposeBinary(LLVMBinaryRef BR)
Dispose of a binary file.
LLVMBool LLVMIsRelocationIteratorAtEnd(LLVMSectionIteratorRef Section, LLVMRelocationIteratorRef SI)
LLVMBinaryType LLVMBinaryGetType(LLVMBinaryRef BR)
Retrieve the specific type of a binary.
void consumeError(Error Err)
Consume a Error without doing anything.
LLVMBinaryRef LLVMMachOUniversalBinaryCopyObjectForArch(LLVMBinaryRef BR, const char *Arch, size_t ArchLen, char **ErrorMessage)
uint64_t LLVMGetSectionAddress(LLVMSectionIteratorRef SI)
@ LLVMBinaryTypeELF32B
ELF 32-bit, big endian.
@ LLVMBinaryTypeWinRes
Windows resource (.res) file.
FunctionType * getType(LLVMContext &Context, ID id, ArrayRef< Type * > Tys=None)
Return the function type for an intrinsic.
static std::unique_ptr< MemoryBuffer > getMemBuffer(StringRef InputData, StringRef BufferName="", bool RequiresNullTerminator=true)
Open the specified memory range as a MemoryBuffer.
LLVMBinaryRef LLVMCreateBinary(LLVMMemoryBufferRef MemBuf, LLVMContextRef Context, char **ErrorMessage)
Create a binary file from the given memory buffer.
struct LLVMOpaqueObjectFile * LLVMObjectFileRef
Deprecated: Use LLVMBinaryRef instead.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
@ LLVMBinaryTypeMachO32L
MachO 32-bit, little endian.
@ LLVMBinaryTypeCOFFImportFile
COFF Import file.
void LLVMMoveToNextRelocation(LLVMRelocationIteratorRef SI)
@ LLVMBinaryTypeELF32L
ELF 32-bit, little endian.
Attribute unwrap(LLVMAttributeRef Attr)
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
void LLVMMoveToContainingSection(LLVMSectionIteratorRef Sect, LLVMSymbolIteratorRef Sym)
const char * LLVMGetSectionContents(LLVMSectionIteratorRef SI)
struct LLVMOpaqueSectionIterator * LLVMSectionIteratorRef
void LLVMDisposeRelocationIterator(LLVMRelocationIteratorRef SI)
struct LLVMOpaqueSymbolIterator * LLVMSymbolIteratorRef
bar al al movzbl eax ret Missed when stored in a memory object
LLVMSymbolIteratorRef LLVMObjectFileCopySymbolIterator(LLVMBinaryRef BR)
Retrieve a copy of the symbol iterator for this object file.
void LLVMDisposeSymbolIterator(LLVMSymbolIteratorRef SI)
@ LLVMBinaryTypeMachO64L
MachO 64-bit, little endian.
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Itanium Name Demangler i e convert the string _Z1fv into and both[sub] projects need to demangle symbols
const char * LLVMGetSymbolName(LLVMSymbolIteratorRef SI)
LLVMSymbolIteratorRef LLVMGetSymbols(LLVMObjectFileRef OF)
Deprecated: Use LLVMObjectFileCopySymbolIterator instead.
LLVMBool LLVMIsSectionIteratorAtEnd(LLVMObjectFileRef OF, LLVMSectionIteratorRef SI)
Deprecated: Use LLVMObjectFileIsSectionIteratorAtEnd instead.
static Expected< OwningBinary< ObjectFile > > createObjectFile(StringRef ObjectPath)
uint64_t LLVMGetSectionSize(LLVMSectionIteratorRef SI)
LLVMSectionIteratorRef LLVMGetSections(LLVMObjectFileRef OF)
Deprecated: Use LLVMObjectFileCopySectionIterator instead.
StandardInstrumentations SI(Debug, VerifyEach)
LLVMBool LLVMObjectFileIsSymbolIteratorAtEnd(LLVMBinaryRef BR, LLVMSymbolIteratorRef SI)
Returns whether the given symbol iterator is at the end.
LLVMRelocationIteratorRef LLVMGetRelocations(LLVMSectionIteratorRef Section)
struct LLVMOpaqueBinary * LLVMBinaryRef
@ LLVMBinaryTypeCOFF
COFF Object file.
LLVMAttributeRef wrap(Attribute Attr)
LLVMSymbolIteratorRef LLVMGetRelocationSymbol(LLVMRelocationIteratorRef RI)
content_iterator< SectionRef > section_iterator
StringRef getTypeName()
We provide a function which tries to compute the (demangled) name of a type statically.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
reference get()
Returns a reference to the stored T value.
@ LLVMBinaryTypeMachO32B
MachO 32-bit, big endian.
@ LLVMBinaryTypeELF64B
ELF 64-bit, big endian.
void logAllUnhandledErrors(Error E, raw_ostream &OS, Twine ErrorBanner={})
Log all errors (if any) in E to OS.
struct LLVMOpaqueRelocationIterator * LLVMRelocationIteratorRef
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
const char * toString(DWARFSectionKind Kind)
@ BR
Control flow instructions. These all have token chains.
void LLVMDisposeObjectFile(LLVMObjectFileRef ObjectFile)
Deprecated: Use LLVMDisposeBinary instead.
const char * LLVMGetRelocationValueString(LLVMRelocationIteratorRef RI)
LLVMSectionIteratorRef LLVMObjectFileCopySectionIterator(LLVMBinaryRef BR)
Retrieve a copy of the section iterator for this object file.
@ LLVMBinaryTypeArchive
Archive file.
const char * LLVMGetSectionName(LLVMSectionIteratorRef SI)
Error takeError()
Take ownership of the stored error.
LLVMMemoryBufferRef LLVMBinaryCopyMemoryBuffer(LLVMBinaryRef BR)
Retrieves a copy of the memory buffer associated with this object file.
uint64_t LLVMGetRelocationType(LLVMRelocationIteratorRef RI)
@ LLVMBinaryTypeELF64L
ELF 64-bit, little endian.
uint64_t LLVMGetSymbolAddress(LLVMSymbolIteratorRef SI)
LLVMBool LLVMObjectFileIsSectionIteratorAtEnd(LLVMBinaryRef BR, LLVMSectionIteratorRef SI)
Returns whether the given section iterator is at the end.
Expected< std::unique_ptr< Binary > > createBinary(MemoryBufferRef Source, LLVMContext *Context=nullptr, bool InitContent=true)
Create a Binary from Source, autodetecting the file type.
struct LLVMOpaqueMemoryBuffer * LLVMMemoryBufferRef
LLVM uses a polymorphic type hierarchy which C cannot represent, therefore parameters must be passed ...
const char * LLVMGetRelocationTypeName(LLVMRelocationIteratorRef RI)
@ LLVMBinaryTypeIR
LLVM IR.
@ LLVMBinaryTypeMachOUniversalBinary
Mach-O Universal Binary file.
std::string & str()
Returns the string's reference.
@ LLVMBinaryTypeMachO64B
MachO 64-bit, big endian.
LLVM_ATTRIBUTE_RETURNS_NONNULL void * safe_malloc(size_t Sz)
@ LLVMBinaryTypeWasm
Web Assembly.
void LLVMMoveToNextSymbol(LLVMSymbolIteratorRef SI)