LLVM 20.0.0git
|
A simple binary serialization of an offloading file. More...
#include "llvm/Object/OffloadBinary.h"
Classes | |
struct | Entry |
struct | Header |
struct | OffloadingImage |
The offloading metadata that will be serialized to a memory buffer. More... | |
struct | StringEntry |
Public Types | |
using | string_iterator = MapVector< StringRef, StringRef >::const_iterator |
using | string_iterator_range = iterator_range< string_iterator > |
Static Public Member Functions | |
static Expected< std::unique_ptr< OffloadBinary > > | create (MemoryBufferRef) |
Attempt to parse the offloading binary stored in Data . | |
static SmallString< 0 > | write (const OffloadingImage &) |
Serialize the contents of File to a binary buffer to be read later. | |
static uint64_t | getAlignment () |
static bool | classof (const Binary *V) |
Static Public Member Functions inherited from llvm::object::Binary | |
static Error | checkOffset (MemoryBufferRef M, uintptr_t Addr, const uint64_t Size) |
Static Public Attributes | |
static const uint32_t | Version = 1 |
The current version of the binary used for backwards compatibility. | |
Additional Inherited Members | |
Protected Types inherited from llvm::object::Binary | |
enum | { ID_Archive , ID_MachOUniversalBinary , ID_COFFImportFile , ID_IR , ID_TapiUniversal , ID_TapiFile , ID_Minidump , ID_WinRes , ID_Offload , ID_StartObjects , ID_COFF , ID_XCOFF32 , ID_XCOFF64 , ID_ELF32L , ID_ELF32B , ID_ELF64L , ID_ELF64B , ID_MachO32L , ID_MachO32B , ID_MachO64L , ID_MachO64B , ID_GOFF , ID_Wasm , ID_EndObjects } |
Protected Member Functions inherited from llvm::object::Binary | |
Binary (unsigned int Type, MemoryBufferRef Source) | |
Static Protected Member Functions inherited from llvm::object::Binary | |
static unsigned int | getELFType (bool isLE, bool is64Bits) |
static unsigned int | getMachOType (bool isLE, bool is64Bits) |
Protected Attributes inherited from llvm::object::Binary | |
MemoryBufferRef | Data |
A simple binary serialization of an offloading file.
We use this format to embed the offloading image into the host executable so it can be extracted and used by the linker.
Many of these could be stored in the same section by the time the linker sees it so we mark this information with a header. The version is used to detect ABI stability and the size is used to find other offloading entries that may exist in the same section. All offsets are given as absolute byte offsets from the beginning of the file.
Definition at line 61 of file OffloadBinary.h.
using llvm::object::OffloadBinary::string_iterator = MapVector<StringRef, StringRef>::const_iterator |
Definition at line 63 of file OffloadBinary.h.
Definition at line 64 of file OffloadBinary.h.
Definition at line 105 of file OffloadBinary.h.
|
static |
Attempt to parse the offloading binary stored in Data
.
Definition at line 171 of file OffloadBinary.cpp.
References llvm::object::OffloadBinary::Header::EntryOffset, llvm::object::OffloadBinary::Header::EntrySize, llvm::errorCodeToError(), getAlignment(), llvm::MemoryBufferRef::getBuffer(), llvm::MemoryBufferRef::getBufferSize(), llvm::MemoryBufferRef::getBufferStart(), llvm::identify_magic(), llvm::object::OffloadBinary::Entry::ImageOffset, llvm::isAddrAligned(), llvm::file_magic::offload_binary, llvm::object::parse_failed, llvm::object::OffloadBinary::Header::Size, llvm::object::OffloadBinary::Entry::StringOffset, llvm::object::unexpected_eof, Version, and llvm::object::OffloadBinary::Header::Version.
Referenced by llvm::object::OffloadFile::copy(), and llvm::object::createBinary().
|
inlinestatic |
Definition at line 84 of file OffloadBinary.h.
|
inline |
Definition at line 93 of file OffloadBinary.h.
References getString().
|
inline |
Definition at line 89 of file OffloadBinary.h.
References llvm::object::OffloadBinary::Entry::Flags.
|
inline |
Definition at line 94 of file OffloadBinary.h.
References llvm::object::OffloadBinary::Entry::ImageOffset, and llvm::object::OffloadBinary::Entry::ImageSize.
|
inline |
Definition at line 86 of file OffloadBinary.h.
References llvm::object::OffloadBinary::Entry::TheImageKind.
|
inline |
Definition at line 87 of file OffloadBinary.h.
References llvm::object::OffloadBinary::Entry::TheOffloadKind.
|
inline |
Definition at line 90 of file OffloadBinary.h.
References llvm::object::OffloadBinary::Header::Size.
Definition at line 103 of file OffloadBinary.h.
Referenced by getArch(), and getTriple().
|
inline |
Definition at line 92 of file OffloadBinary.h.
References getString().
|
inline |
Definition at line 88 of file OffloadBinary.h.
References llvm::object::OffloadBinary::Header::Version.
|
inline |
Definition at line 99 of file OffloadBinary.h.
|
static |
Serialize the contents of File
to a binary buffer to be read later.
Definition at line 207 of file OffloadBinary.cpp.
References llvm::StringTableBuilder::add(), llvm::alignTo(), assert(), llvm::object::Binary::Data, llvm::StringTableBuilder::ELF, llvm::object::OffloadBinary::Header::EntryOffset, llvm::object::OffloadBinary::Header::EntrySize, llvm::StringTableBuilder::finalize(), llvm::object::OffloadBinary::OffloadingImage::Flags, llvm::object::OffloadBinary::Entry::Flags, getAlignment(), llvm::StringTableBuilder::getOffset(), llvm::StringTableBuilder::getSize(), llvm::object::OffloadBinary::OffloadingImage::Image, llvm::object::OffloadBinary::Entry::ImageOffset, llvm::object::OffloadBinary::Entry::ImageSize, llvm::object::OffloadBinary::Entry::NumStrings, llvm::Offset, OS, llvm::object::OffloadBinary::Header::Size, llvm::object::OffloadBinary::OffloadingImage::StringData, llvm::object::OffloadBinary::Entry::StringOffset, llvm::raw_ostream::tell(), llvm::object::OffloadBinary::OffloadingImage::TheImageKind, llvm::object::OffloadBinary::Entry::TheImageKind, llvm::object::OffloadBinary::OffloadingImage::TheOffloadKind, llvm::object::OffloadBinary::Entry::TheOffloadKind, llvm::StringTableBuilder::write(), and llvm::raw_ostream::write_zeros().
Referenced by llvm::yaml::yaml2offload().
The current version of the binary used for backwards compatibility.
Definition at line 67 of file OffloadBinary.h.
Referenced by create().