{"id":13875984,"url":"https://github.com/bjorn3/rustc_codegen_cranelift","last_synced_at":"2025-07-16T10:32:14.732Z","repository":{"id":38325166,"uuid":"138330481","full_name":"rust-lang/rustc_codegen_cranelift","owner":"rust-lang","description":"Cranelift based backend for rustc","archived":false,"fork":false,"pushed_at":"2024-10-24T17:23:30.000Z","size":6119,"stargazers_count":1610,"open_issues_count":74,"forks_count":100,"subscribers_count":35,"default_branch":"master","last_synced_at":"2024-10-29T15:45:04.892Z","etag":null,"topics":["aot","compiler","cranelift","jit","rust"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rust-lang.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-06-22T17:31:42.000Z","updated_at":"2024-10-27T09:57:04.000Z","dependencies_parsed_at":"2023-11-19T14:03:16.283Z","dependency_job_id":"0907489b-80ec-4a0b-9c04-633aa56aad9c","html_url":"https://github.com/rust-lang/rustc_codegen_cranelift","commit_stats":{"total_commits":2960,"total_committers":126,"mean_commits":23.49206349206349,"dds":0.3256756756756757,"last_synced_commit":"b56d4ab66b8574e8b583793e536326a40eeab384"},"previous_names":["rust-lang/rustc_codegen_cranelift","bjorn3/rustc_codegen_cranelift"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-lang%2Frustc_codegen_cranelift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-lang%2Frustc_codegen_cranelift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-lang%2Frustc_codegen_cranelift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-lang%2Frustc_codegen_cranelift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rust-lang","download_url":"https://codeload.github.com/rust-lang/rustc_codegen_cranelift/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226122303,"owners_count":17576920,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aot","compiler","cranelift","jit","rust"],"created_at":"2024-08-06T06:00:53.989Z","updated_at":"2025-07-16T10:32:14.678Z","avatar_url":"https://github.com/rust-lang.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# Cranelift codegen backend for rust\n\nThe goal of this project is to create an alternative codegen backend for the rust compiler based on [Cranelift](https://github.com/bytecodealliance/wasmtime/blob/main/cranelift).\nThis has the potential to improve compilation times in debug mode.\nIf your project doesn't use any of the things listed under \"Not yet supported\", it should work fine.\nIf not please open an issue.\n\n## Download using Rustup\n\nThe Cranelift codegen backend is distributed in nightly builds on Linux, macOS and x86_64 Windows. If you want to\ninstall it using Rustup, you can do that by running:\n\n```bash\n$ rustup component add rustc-codegen-cranelift-preview --toolchain nightly\n```\n\nOnce it is installed, you can enable it with one of the following approaches:\n- `CARGO_PROFILE_DEV_CODEGEN_BACKEND=cranelift cargo +nightly build -Zcodegen-backend`\n- Add the following to `.cargo/config.toml`:\n    ```toml\n    [unstable]\n    codegen-backend = true\n\n    [profile.dev]\n    codegen-backend = \"cranelift\"\n    ```\n- Add the following to `Cargo.toml`:\n    ```toml\n    # This line needs to come before anything else in Cargo.toml\n    cargo-features = [\"codegen-backend\"]\n\n    [profile.dev]\n    codegen-backend = \"cranelift\"\n    ```\n\n## Precompiled builds\n\nYou can also download a pre-built version from the [releases] page.\nExtract the `dist` directory in the archive anywhere you want.\nIf you want to use `cargo clif build` instead of having to specify the full path to the `cargo-clif` executable, you can add the `bin` subdirectory of the extracted `dist` directory to your `PATH`.\n(tutorial [for Windows](https://stackoverflow.com/a/44272417), and [for Linux/MacOS](https://unix.stackexchange.com/questions/26047/how-to-correctly-add-a-path-to-path/26059#26059)).\n\n[releases]: https://github.com/rust-lang/rustc_codegen_cranelift/releases/tag/dev\n\n## Building and testing\n\nIf you want to build the backend manually, you can download it from GitHub and build it yourself:\n\n```bash\n$ git clone https://github.com/rust-lang/rustc_codegen_cranelift\n$ cd rustc_codegen_cranelift\n$ ./y.sh build\n```\n\nTo run the test suite replace the last command with:\n\n```bash\n$ ./y.sh prepare # only needs to be run the first time\n$ ./test.sh\n```\n\nFor more docs on how to build and test see [build_system/usage.txt](build_system/usage.txt) or the help message of `./y.sh`.\n\n## Platform support\n\n|OS \\ architecture|x86\\_64|AArch64|Riscv64|s390x (System-Z)|\n|---|---|---|---|---|\n|Linux|✅|✅|✅[^no-rustup]|✅[^no-rustup]|\n|FreeBSD|✅[^no-rustup]|❓|❓|❓|\n|AIX|❌[^xcoff]|N/A|N/A|❌[^xcoff]|\n|Other unixes|❓|❓|❓|❓|\n|macOS|✅|✅|N/A|N/A|\n|Windows|✅|❌|N/A|N/A|\n\n✅: Fully supported and tested\n❓: Maybe supported, not tested\n❌: Not supported at all\n\nNot all targets are available as rustup component for nightly. See notes in the platform support matrix.\n\n[^xcoff]: XCOFF object file format is not supported.\n[^no-rustup]: Not available as [rustup component for nightly](https://rust-lang.github.io/rustup-components-history/). You can build it yourself.\n\n## Usage\n\nrustc_codegen_cranelift can be used as a near-drop-in replacement for `cargo build` or `cargo run` for existing projects.\n\nAssuming `$cg_clif_dir` is the directory you cloned this repo into and you followed the instructions (`y.sh prepare` and `y.sh build` or `test.sh`).\n\nIn the directory with your project (where you can do the usual `cargo build`), run:\n\n```bash\n$ $cg_clif_dir/dist/cargo-clif build\n```\n\nThis will build your project with rustc_codegen_cranelift instead of the usual LLVM backend.\n\nFor additional ways to use rustc_codegen_cranelift like the JIT mode see [usage.md](docs/usage.md).\n\n## Building and testing with changes in rustc code\n\nSee [rustc_testing.md](docs/rustc_testing.md).\n\n## Not yet supported\n\n* SIMD ([tracked here](https://github.com/rust-lang/rustc_codegen_cranelift/issues/171), `std::simd` fully works, `std::arch` is partially supported)\n* Unwinding on panics ([experimental and not supported on Windows and macOS](https://github.com/rust-lang/rustc_codegen_cranelift/issues/1567), `-Cpanic=abort` is enabled by default)\n\n## License\n\nLicensed under either of\n\n  * Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or\n    http://www.apache.org/licenses/LICENSE-2.0)\n  * MIT license ([LICENSE-MIT](LICENSE-MIT) or\n    http://opensource.org/licenses/MIT)\n\nat your option.\n\n### Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you shall be dual licensed as above, without any\nadditional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbjorn3%2Frustc_codegen_cranelift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbjorn3%2Frustc_codegen_cranelift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbjorn3%2Frustc_codegen_cranelift/lists"}