File size: 8,676 Bytes
e200a7c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d8446e7
e200a7c
 
 
 
d8446e7
 
e200a7c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d8446e7
 
 
e200a7c
 
 
 
d8446e7
 
 
e200a7c
 
 
 
 
 
 
 
 
 
 
 
 
d8446e7
 
 
 
 
 
 
 
 
 
 
 
 
 
e200a7c
 
 
 
 
 
d8446e7
 
 
 
 
e200a7c
 
 
 
d8446e7
 
 
 
 
e200a7c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d8446e7
 
 
 
 
 
 
 
 
 
 
e200a7c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
---
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}
}
```