assemblage-rust / README.md
changliu8541's picture
Add files using upload-large-folder tool
d8446e7 verified
|
Raw
History Blame Contribute Delete
8.68 kB
---
license: other
license_name: mixed-permissive
license_link: https://huggingface.co/datasets/changliu8541/assemblage-rust/blob/main/LICENSES.csv
pretty_name: Assemblage-Rust
language:
- en
tags:
- binary-analysis
- reverse-engineering
- rust
- compilers
- debug-information
- decompilation
size_categories:
- 10K<n<100K
---
# Assemblage-Rust
An **unprocessed** Rust dataset crawled from GitHub: raw build outputs, filtered
only by license. Not cleaned, deduplicated, or curated.
A corpus of **18,450 compiled Rust binaries** built from **3,034 permissively
licensed GitHub repositories**, each paired with DWARF-derived function and line
metadata, the **source tree it was compiled from**, and, for a subset, compiler
intermediate representations.
Produced by [Assemblage](https://arxiv.org/abs/2405.03991), a distributed
binary-corpus generator. Every repository is built across a matrix of codegen
backends, build modes and optimization levels, so the same source appears many
times under different compilation settings — which is the point: it supports
studying how compilation choices affect the resulting binary.
## Layout
The corpus ships as **one uncompressed tar per upstream repository** (3,033 of
them, ~105 MB on average). Everything inside is already compressed — `zstd` for
binaries and metadata, `gzip` for IR — so the tar is pure container, and you can
stream a single repository without fetching the rest.
```
repos/{owner}__{project}.tar builds: binaries, metadata, IR
sources/{owner}__{project}.tar.gz the source tree each was built from
sources/manifest.json source file -> repo URL, commit, license, tar
index.jsonl one line per build: dir, tar, repo_url, commit, license, sizes
LICENSES.csv build directory -> repo URL, commit, license
```
Builds and source are keyed on the same slug, so `repos/X.tar` pairs with
`sources/X.tar.gz` — no lookup table needed for the common case.
Each tar expands to one directory per build:
```
{owner}_{project}_{sha12}-{flag}-{backend}-{mode}/
├── binaries/<name>.zst ELF binaries, zstd -12
├── metadata/assemblage_meta.json.zst DWARF functions, RVAs, line mappings
├── ir/<stage>.tar.gz LLVM-IR / MIR / HIR / THIR / ASM (subset)
└── export.json provenance, license, byte counts
```
The build mode is part of the directory name because `Debug`, `RelWithDebInfo`
and `Release` of the same commit are distinct binaries.
### Source
`sources/` ships the exact tree each binary was compiled from — 3,033 archives,
~31 GiB, one per repository, at the single commit recorded in `index.jsonl`. They
are the builder's own `git clone --recursive` snapshot, captured **before** the
build ran, so they contain no `target/` directory and no build output. `.git` is
included, so history and the exact tree hash are recoverable.
This matters because the alternative is depending on GitHub: a repository that is
deleted, made private or force-pushed after collection would otherwise leave its
binaries permanently unaccompanied, with DWARF naming `source_file` paths nothing
could resolve. Source correspondence is a property of the release, not of an
upstream that may not survive it.
```bash
# fetch and unpack one repository
huggingface-cli download changliu8541/assemblage-rust \
repos/tokio-rs__tokio.tar --repo-type dataset --local-dir .
tar xf repos/tokio-rs__tokio.tar
# fetch the matching source tree
huggingface-cli download changliu8541/assemblage-rust \
sources/tokio-rs__tokio.tar.gz --repo-type dataset --local-dir .
mkdir -p src-tokio && tar xzf sources/tokio-rs__tokio.tar.gz -C src-tokio
# read a binary and its metadata
zstd -d */binaries/mytool.zst -o mytool
zstd -dc */metadata/assemblage_meta.json.zst | jq .
# resolve a DWARF source_file against the shipped tree
zstd -dc */metadata/assemblage_meta.json.zst \
| jq -r '.Binary_info_list[0].functions[] | select(.origin=="in_repo") | .source_file' \
| sort -u | head
# find builds without downloading anything
jq -r 'select(.license=="MIT License" and .has_ir) | .tar' index.jsonl | sort -u
```
## Build matrix
| dimension | values |
|---|---|
| codegen backend | `llvm` (12,622) · `cranelift` (2,986) · `gcc` (2,842) |
| build mode | `RelWithDebInfo` (10,264) · `Release` (6,145) · `Debug` (2,041) |
| optimization | `O2` (5,599) · `O0` (3,820) · `Os` (2,573) · `O3` (2,453) · `Oz` (2,198) · `O1` (1,807) |
Toolchain: `nightly-2026-06-15`, symbol mangling `v0`, `x86_64-unknown-linux-gnu`.
**4,278 builds carry IR dumps** (`llvm-ir`, `mir`, `hir`, `thir`, `asm`), emitted
only for the LLVM `RelWithDebInfo` tiers and scoped to repository crates rather
than dependencies.
## Metadata
`assemblage_meta.json` records, per binary, every function recovered from DWARF:
```jsonc
{
"function_name": "_RINvNtCs...", // mangled
"demangled_name": "core::ptr::drop_glue::<...>",
"source_file": "src/engine.rs",
"function_info": [{"rva_start": "...", "rva_end": "..."}],
"lines": [{"line_number": 42, "rva": "...", "length": 10}],
"origin": "in_repo | dependency | stdlib | other"
}
```
## Known limitations
Please read these before using the corpus — they are properties of the data, not
bugs to work around silently.
1. **~26% of builds that ship binaries have empty or partial function metadata.**
DWARF extraction runs under a wall-clock budget; when a binary exceeds it the
binary is still published but its `Binary_info_list` entry is dropped. Check
`Binary_info_list` length before assuming coverage.
2. **Lib-only crates produce metadata but no binaries.** Roughly a quarter of
builds are metadata-only.
3. **`Release` binaries carry little repository DWARF by design.** Repository
symbols survive in `.symtab`; most DWARF present belongs to the precompiled
standard library. Filter on `origin`.
4. **The `gcc` (cg_gcc) backend is a name/address corpus.** Mangling and symbol
tables are sound, but repository-level `source_file` and line information is
largely absent, and standard-library paths are recorded relative.
5. **`origin: in_repo` is under-assigned.** Classification resolves paths against
the clone directory at extraction time, so workspace-relative paths can fall
through to `other`. Treat `in_repo` as a lower bound.
6. **Builds with IR were compiled with `--emit`,** which repartitions codegen
units. `.text` bytes differ from a non-IR build of the same commit; symbols,
`.rodata`, `.data` and `.eh_frame` are byte-identical. DWARF and RVAs come
from the published binary and are self-consistent.
## Licensing and attribution
Every repository in this corpus carries an OSI-recognized permissive license,
verified by database join against the scraper's license records. Copyleft
(GPL/AGPL/LGPL/MPL/EPL/EUPL) and unidentified-license repositories were
**excluded** from this release.
| license | builds |
|---|---|
| MIT | 13,241 |
| Apache-2.0 | 4,448 |
| BSD-3-Clause | 214 |
| Unlicense | 177 |
| BSD-2-Clause | 91 |
| 0BSD | 73 |
| ISC | 55 |
| CC0-1.0 | 54 |
| Blue Oak 1.0.0 | 34 |
| WTFPL | 29 |
| BSL-1.0 | 27 |
| Artistic-2.0 | 4 |
| Zlib | 2 |
| MIT-0 | 1 |
`LICENSES.csv` maps every build directory to its upstream repository URL, commit
and license; the same fields appear in each build's `export.json` and in
`sources/manifest.json`. MIT, BSD and Apache-2.0 require that copyright and
license notices accompany redistribution. Because `sources/` ships each
repository's tree verbatim, those notices — `LICENSE`, `NOTICE`, per-file
headers — travel **with** the data rather than only being pointed at, which is
the condition those licenses actually ask for. The recorded URL and commit
identify the upstream each one came from.
Note that the shipped trees include `.git`, so they also carry commit history and
its author names and email addresses, as published by those repositories on
GitHub.
If you are an author of an included repository and want it removed, open a
discussion on this dataset and it will be taken out.
## Citation
If you find this dataset useful, please consider citing our paper:
[Assemblage: Automatic Binary Dataset Construction for Machine Learning](https://arxiv.org/abs/2405.03991).
```bibtex
@article{liu2024assemblage,
title={Assemblage: Automatic Binary Dataset Construction for Machine Learning},
author={Liu, Chang and Saul, Rebecca and Sun, Yihao and Raff, Edward and
Fuchs, Maya and Southard Pantano, Townsend and Holt, James and
Micinski, Kristopher},
journal={arXiv preprint arXiv:2405.03991},
year={2024}
}
```