LLVM Bitcode MIME Type
application/x-llvm files contain, how to identify and inspect LLVM bitcode, and what Poly supports. MIME type details for application/x-llvm
In active use| MIME type | application/x-llvm |
|---|---|
| Extensions | .bc |
| Magic number | 42 43 C0 DE |
| First standardized | Not formally standardized; LLVM 1.0 released 2003 |
| Created by | Chris Lattner and the LLVM Project |
| Browser support | No native browser support |
| Example applications | LLVM llvm-dis, LLVM lli |
| Poly support | Partial. Poly recognizes .bc as application/x-llvm and stores, syncs, shares, and versions it, but does not parse LLVM bitcode. |
| Indexed by Poly | Partial. Poly indexes the filename and ordinary file properties, but not functions, symbols, metadata, or other bitcode contents. |
| Preview in Poly | No. LLVM bitcode does not open in an in-app viewer; download it and use an LLVM tool such as llvm-dis. |
| Poly agent | No. The Poly agent cannot read or reason about the contents of application/x-llvm files. |
What does application/x-llvm mean?
The application/x-llvm media type is used for LLVM bitcode, the compact binary encoding of LLVM intermediate representation (IR). These files usually end in .bc. LLVM describes bitcode as a general bitstream container plus a specific encoding for LLVM IR, including modules, functions, types, constants, instructions, and metadata.1
Bitcode is not native machine code. It preserves a compiler-level representation that LLVM tools can analyze, optimize, link, interpret, or translate for a target architecture. A .bc file may still be target-specific because its module can include a target triple, data layout, target-dependent types, and other assumptions.
application/x-llvm is not in IANA's registered media-type list. The x- spelling is a convention used by software and file-identification databases, not an IETF registration. RFC 6838 also cautions that an x- prefix no longer has formal registration-tree meaning.23How to identify an LLVM bitcode file
Raw LLVM IR bitcode starts with four bytes that read 42 43 C0 DE in hexadecimal. The first two bytes are ASCII B and C. LLVM's bitcode specification warns that a magic number is an identifier, not a complete validity check, so a parser still needs to validate the stream.1
Some bitcode uses LLVM's optional wrapper format. Its 32-bit little-endian magic value is 0x0B17C0DE, which appears on disk as DE C0 17 0B. LLVM IR can also be embedded in a native object file, in a __LLVM,__bitcode Mach-O section or an .llvmbc section in another object format.1 Those wrapped or embedded files are not necessarily served as application/x-llvm.
The extension is a useful clue, but inspect the contents when provenance matters:
file module.bc
llvm-bcanalyzer module.bc
llvm-dis module.bc -o module.ll
llvm-bcanalyzer examines the bitstream structure. llvm-dis performs the more useful everyday conversion, decoding bitcode into human-readable LLVM assembly.4
Is .bc the same as .ll?
They can represent the same LLVM IR module, but they are different serializations.
| Property | LLVM bitcode | LLVM assembly |
|---|---|---|
| Common extension | .bc | .ll |
| Representation | Binary bitstream | Human-readable text |
| Typical media type | application/x-llvm | Often text/x-llvm or plain text |
| Convert to the other form | llvm-dis module.bc -o module.ll | llvm-as module.ll -o module.bc |
| Best suited to | Tool pipelines and compact interchange | Reading, reviewing, and editing |
LLVM's llvm-as reads human-readable LLVM assembly and writes bitcode. llvm-dis does the reverse.45 Clang can emit either form: -emit-llvm -c produces .bc, while -emit-llvm -S produces .ll.6
Changing the suffix does not perform this conversion. A binary .bc file renamed to .ll is still binary bitcode.
History and registration status
LLVM began as Chris Lattner's research project at the University of Illinois. The project released LLVM 1.0 in 2003, establishing the public toolchain and IR lineage from which current LLVM bitcode developed.7 Unlike a format fixed by an external interchange standard, LLVM IR and its bitcode encoding evolve with the compiler project.
The media type evolved informally too. application/x-llvm is useful as a deployed label for .bc files, but it has no IANA registration template that defines parameters, canonical encoding, or security considerations.2 When an HTTP service controls both ends, document the expected LLVM version and confirm that the recipient treats the payload as binary.
How to open and use a .bc file
A web browser does not provide a native LLVM bitcode viewer. Use an LLVM toolchain built for the file's provenance:
llvm-disconverts the module to readable.lltext.llvm-bcanalyzerreports low-level blocks and records.optanalyzes or transforms the IR.llvm-linkcombines bitcode modules.lliinterprets or JIT-compiles a program represented as bitcode.llccompiles LLVM IR to target assembly.
LLVM's Getting Started guide demonstrates generating .bc with Clang, viewing it through llvm-dis, running it with lli, and compiling it with llc.6
Textual .ll is not a safer universal archive substitute. LLVM's developer policy explicitly gives the textual format no backward-compatibility promise.8 For long-term reproducibility, retain source code, build configuration, compiler version, target details, and any required plugins alongside generated IR.
Support in Poly
Poly recognizes .bc by filename and assigns application/x-llvm. It can store, sync, share, version, download, and search for the file by name. Support stops at the binary boundary:
- Poly does not parse the bitcode module or extract symbols and LLVM metadata.
- Bitcode content is not indexed for full-text or semantic search.
- There is no in-app bitcode or disassembly preview.
- The Poly agent cannot read the module's contents.
This is different from a source-code file. Poly classifies application/x-llvm as an unknown binary media type, so it follows the generic metadata-only indexing path rather than the text extraction and code-editor path.
For a readable copy in Poly, create a sibling .ll file with llvm-dis. Poly can handle that UTF-8 text through its normal source-text workflow, although the .ll file is separate from the original .bc artifact.
Compatibility and security considerations
Bitcode is often described as portable, but portability has boundaries. A module can depend on a target's data layout, calling conventions, address spaces, CPU features, external symbols, or compiler-specific metadata. Use llvm-dis or LLVM APIs to inspect the target triple and module contents instead of assuming that any LLVM installation can execute it.
Treat untrusted bitcode like untrusted compiler input. LLVM's security policy states that a maliciously crafted bitcode file can cause arbitrary code execution in LLVM and that these toolchain paths are not hardened for hostile inputs.9 Inspect unknown files in an isolated environment, keep LLVM patched, and do not run lli, optimization passes, or code generation on an untrusted module as though it were passive data.
llvm-dis and llvm-bcanalyzer that you would use for a compiler processing untrusted source.Footnotes
- LLVM Project. LLVM Bitcode File Format. ↩ ↩2 ↩3
- Internet Assigned Numbers Authority. Media Types Registry. The application registry does not list
application/x-llvm. ↩ ↩2 - Internet Engineering Task Force. RFC 6838, Media Type Specifications and Registration Procedures. ↩
- LLVM Project. llvm-dis: LLVM Disassembler. ↩ ↩2
- LLVM Project. llvm-as: LLVM Assembler. ↩
- LLVM Project. Getting Started with the LLVM System. ↩ ↩2
- LLVM Project. LLVM Old News and Release History. LLVM 1.0 was released on November 18, 2003. ↩
- LLVM Project. LLVM Developer Policy: IR Backwards Compatibility. ↩ ↩2
- LLVM Project. LLVM Security Response Group. ↩