LLVM-OFFLOAD-BINARY(1)
π LLVM-OFFLOAD-BINARY(1) π
okay bestie, welcome to the LLVM manual, girlies, this is llvm-offload-binary and she is that utility. sit down, get comfy, we're bundling device objects. π¦
β¨ NAME β¨
llvm-offload-binary β the LLVM Offload Binary Packager, no cap π
β¨ SYNOPSIS β¨
llvm-offload-binary [options] [input files...]
β¨ DESCRIPTION β¨
so llvm-offload-binary is a little utility that's literally obsessed with bundling a whole bunch of device object files into one single binary container. like, imagine a group chat but for object files. π
the resulting binary can then get embedded into the host section table to form a fat binary that carries offloading code for different targets. and conversely (yes, conversely, we're being fancy), it can also extract previously bundled device images back out. it's giving dual-threat. β¨
now let's talk format, because the format is the moment. the binary format begins with the magic bytes 0x10FF10AD, and after that comes a version and a size. every single binary carries its own header, which means tools can locate offloading sections even when they get merged by a linker. iconic behavior honestly. each offload entry comes with metadata like the device image kind, the producer kind, and key-value string metadata. and multiple offloading images are just concatenated together to form that fat binary. π
β¨ EXAMPLE β¨
# Package multiple device images into a fat binary:
$ llvm-offload-binary -o out.bin \
--image=file=input.o,triple=nvptx64,arch=sm_70
# Extract a matching image from a fat binary:
$ llvm-offload-binary in.bin \
--image=file=output.o,triple=nvptx64,arch=sm_70
# Extract and archive images into a static library:
$ llvm-offload-binary in.bin --archive -o libdevice.a
periodt. π
β¨ OPTIONS β¨
--archiveβ when you're extracting from an input binary, this makes all the extracted images get written into a static archive instead of being dumped out as separate files. so organized of her. π§--image=<<key>=<value>,...>β specify a set of arbitrary key-value arguments that describe an image. the commonly used optional keys includearch(likesm_70for CUDA, iykyk) andtriple(likenvptx64-nvidia-cuda). π-o <file>β write output to<file>. when bundling, this is the fat binary filename. when extracting, this is the archive or output file destination. she's flexible like that. π--help,-hβ display the available options. use--help-hiddento show the hidden options (the secret menu, lowkey). π₯--help-listβ display a list of all the options. use--help-list-hiddento show the hidden ones too. π--versionβ display the version of thellvm-offload-binaryexecutable. π«@<FILE>β read command-line options from a response file<FILE>. πΈ
β¨ BINARY FORMAT β¨
okay this is the part where we get into the lore. the binary format is marked by the magic bytes 0x10FF10AD, followed by a version number. every binary that gets created contains its own header, which is exactly what lets tools locate offloading sections even after linker operations like relocatable linking. conceptually, this binary format is a serialization of a string map and an image buffer. that's the whole vibe. π¦
π Offloading Binary Header π
uint8_tmagicβ the magic bytes for the binary format (0x10FF10AD)uint32_tversionβ version of this format (currently version1)uint64_tsizeβ size of this binary in bytesuint64_tentry offsetβ absolute offset of the offload entries in bytesuint64_tentry sizeβ size of the offload entries in bytes
each offload entry describes a bundled image along with its associated metadata. π
π Offloading Entry Table π
uint16_timage kindβ the kind of the device image (e.g.bc,cubin)uint16_toffload kindβ the producer of the image (e.g.openmp,cuda)uint32_tflagsβ generic flags for the imageuint64_tstring offsetβ absolute offset of the string metadata tableuint64_tnum stringsβ number of string entries in the tableuint64_timage offsetβ absolute offset of the device image in bytesuint64_timage sizeβ size of the device image in bytes
the entry table refers to both a string table and the raw device image itself. the string table provides arbitrary key-value metadata. π
π Offloading String Entry π
uint64_tkey offsetβ absolute byte offset of the key in the string tableuint64_tvalue offsetβ absolute byte offset of the value in the string table
the string table is a collection of null-terminated strings stored in the image. the offsets are what allow string entries to be interpreted as key-value pairs, which is how you get flexible metadata like architecture or target triple. slay. β¨
the enumerated values for image kind and offload kind are:
π Image Kind π
ok so this is the little enum that tells you what flavour of image you're looking at. every single value, no skips, bestie:
IMG_Noneβ0x00β no image information provided. literally nothing, she's empty πIMG_Objectβ0x01β the image is a generic object fileIMG_Bitcodeβ0x02β the image is an LLVM-IR bitcode fileIMG_Cubinβ0x03β the image is a CUDA object fileIMG_Fatbinaryβ0x04β the image is a CUDA fatbinary fileIMG_PTXβ0x05β the image is a CUDA PTX file
π¦ Offload Kind π¦
and this one is who made you β the producer vibes check. all five, verbatim:
OFK_Noneβ0x00β no offloading information providedOFK_OpenMPβ0x01β the producer was OpenMP offloadingOFK_CUDAβ0x02β the producer was CUDAOFK_HIPβ0x03β the producer was HIPOFK_SYCLβ0x04β the producer was SYCL
π SEE ALSO π
go read your siblings, they're iconic too:
clang(1)<clang.html>llvm-objdump(1)<llvm-objdump.html>
π Author π
maintained by the LLVM Team (https://llvm.org/). they keep the whole thing running, periodt β¨
π Copyright π
2003-2026, LLVM Project. that's a two-decade glow-up, no cap π«Ά
ok bestie that's the whole page, you made it to the end π this was LLVM-OFFLOAD-BINARY(1), page 22, dated 2026-07-16 β go offload something cute, drink some water, and remember: the binary format was never the enemy, it was just β¨ undocumented β¨ π
πΈπ¦
π¦ where this page comes from
- fedora 44: llvm 22.1.8-4.fc44 Β· Apache-2.0 WITH LLVM-exception OR NCSA
- fedora 44: llvm 22.1.8-4.fc44 Β· Apache-2.0 WITH LLVM-exception OR NCSA
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms