{"id":50844175,"url":"https://github.com/suhteevah/rustc-lite","last_synced_at":"2026-06-14T08:05:51.829Z","repository":{"id":352001669,"uuid":"1199811017","full_name":"suhteevah/rustc-lite","owner":"suhteevah","description":"Minimal no_std Rust compiler using Cranelift backend","archived":false,"fork":false,"pushed_at":"2026-06-07T09:28:12.000Z","size":28,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-07T11:16:52.068Z","etag":null,"topics":["bare-metal","compiler","cranelift","embedded","no-std","operating-system","osdev","rust","rust-compiler"],"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/suhteevah.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-02T18:25:25.000Z","updated_at":"2026-06-07T09:28:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"3fed2225-8f4f-4cfe-bdde-60c39689b387","html_url":"https://github.com/suhteevah/rustc-lite","commit_stats":null,"previous_names":["suhteevah/rustc-lite"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/suhteevah/rustc-lite","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suhteevah%2Frustc-lite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suhteevah%2Frustc-lite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suhteevah%2Frustc-lite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suhteevah%2Frustc-lite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/suhteevah","download_url":"https://codeload.github.com/suhteevah/rustc-lite/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suhteevah%2Frustc-lite/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34313655,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-14T02:00:07.365Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["bare-metal","compiler","cranelift","embedded","no-std","operating-system","osdev","rust","rust-compiler"],"created_at":"2026-06-14T08:05:43.185Z","updated_at":"2026-06-14T08:05:51.814Z","avatar_url":"https://github.com/suhteevah.png","language":"Rust","funding_links":["https://www.paypal.me/baal_hosting","https://paypal.me/baal_hosting"],"categories":[],"sub_categories":[],"readme":"# rustc-lite\n\n[![Crates.io](https://img.shields.io/crates/v/rustc-lite.svg)](https://crates.io/crates/rustc-lite)\n[![docs.rs](https://img.shields.io/docsrs/rustc-lite)](https://docs.rs/rustc-lite)\n[![License](https://img.shields.io/crates/l/rustc-lite.svg)](https://github.com/suhteevah/rustc-lite#license)\n\nMinimal `no_std` Rust compiler using the **Cranelift** backend -- no LLVM required.\n\nCompiles a subset of Rust to x86_64 machine code directly, suitable for bare-metal\nand embedded JIT compilation scenarios. Originally built as part of\n[ClaudioOS](https://github.com/suhteevah/claudio-os), a bare-metal Rust operating\nsystem that runs AI coding agents on raw hardware.\n\n## What it does\n\n- **Cranelift code generation** -- uses the Cranelift compiler backend to produce\n  native x86_64 machine code without any LLVM dependency\n- **`no_std` compatible** -- works with only `alloc`, no standard library required\n- **JIT execution** -- compile functions at runtime and call them immediately\n- **Bare-metal ready** -- designed to run on bare metal with no OS underneath\n\n## Supported Rust features\n\nThis is an early-stage compiler. Currently it provides:\n\n- Function creation with Cranelift IR\n- Integer arithmetic (`i64` operations: add, sub, mul, etc.)\n- SystemV calling convention for x86_64\n- Direct machine code emission and execution\n\nThe compiler is being actively developed to support more Rust constructs including\nvariables, control flow, structs, and basic type checking.\n\n## Usage\n\nAdd to your `Cargo.toml`:\n\n```toml\n[dependencies]\nrustc-lite = \"0.1\"\n```\n\n### Verify Cranelift initialization\n\n```rust\nassert!(rustc_lite::test());\n```\n\n### JIT compile and execute a function\n\n```rust\n// Compiles: fn add(a: i64, b: i64) -\u003e i64 { a + b }\n// Then calls add(3, 4) and verifies the result is 7\nassert!(rustc_lite::test_jit());\n```\n\n### Building Cranelift IR manually\n\nThe crate re-exports nothing from Cranelift directly, but you can use the same\npattern shown in `test_jit()` to build your own functions:\n\n1. Create an x86_64 ISA via `cranelift_codegen::isa::lookup_by_name`\n2. Define a `Signature` with `AbiParam` types\n3. Build IR using `FunctionBuilder`\n4. Compile with `Context::compile`\n5. Copy the resulting machine code to executable memory and call it\n\n## Cranelift `no_std` forks\n\n**Important:** The upstream `cranelift-codegen` and `cranelift-frontend` crates\ndepend on `std`. To use this crate in a `no_std` / bare-metal environment, you\nneed patched forks of the Cranelift crates.\n\nThe ClaudioOS project maintains these forks:\n\n| Crate | Fork |\n|-------|------|\n| `cranelift-codegen` | `cranelift-codegen-nostd` |\n| `cranelift-frontend` | `cranelift-frontend-nostd` |\n| `cranelift-codegen-shared` | `cranelift-codegen-shared-nostd` |\n| `cranelift-control` | `cranelift-control-nostd` |\n| `rustc-hash` | `rustc-hash-nostd` |\n| `arbitrary` | `arbitrary-stub` |\n\nTo use them, add `[patch.crates-io]` entries in your workspace `Cargo.toml`:\n\n```toml\n[patch.crates-io]\ncranelift-codegen = { path = \"path/to/cranelift-codegen-nostd\" }\ncranelift-frontend = { path = \"path/to/cranelift-frontend-nostd\" }\ncranelift-codegen-shared = { path = \"path/to/cranelift-codegen-shared-nostd\" }\ncranelift-control = { path = \"path/to/cranelift-control-nostd\" }\nrustc-hash = { path = \"path/to/rustc-hash-nostd\" }\narbitrary = { path = \"path/to/arbitrary-stub\" }\n```\n\nIf you are targeting a hosted platform (Linux, macOS, Windows), the upstream\nCranelift crates work as-is and no patches are needed.\n\n## Origin\n\nThis crate was extracted from the [ClaudioOS](https://github.com/suhteevah/claudio-os)\nproject -- a bare-metal Rust OS that boots via UEFI and runs multiple AI coding\nagents (Claude) simultaneously with no Linux kernel, no POSIX, and no JavaScript\nruntime. `rustc-lite` provides the self-hosting compilation foundation, allowing\nthe OS to compile Rust code on bare metal using Cranelift.\n\n## License\n\nLicensed under either of\n\n- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or \u003chttp://www.apache.org/licenses/LICENSE-2.0\u003e)\n- MIT License ([LICENSE-MIT](LICENSE-MIT) or \u003chttp://opensource.org/licenses/MIT\u003e)\n\nat your option.\n\n### Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be\ndual licensed as above, without any additional terms or conditions.\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n---\n\n## Support This Project\n\nIf you find this project useful, consider buying me a coffee! Your support helps me keep building and sharing open-source tools.\n\n[![Donate via PayPal](https://img.shields.io/badge/Donate-PayPal-blue.svg?logo=paypal)](https://www.paypal.me/baal_hosting)\n\n**PayPal:** [baal_hosting@live.com](https://paypal.me/baal_hosting)\n\nEvery donation, no matter how small, is greatly appreciated and motivates continued development. Thank you!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuhteevah%2Frustc-lite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsuhteevah%2Frustc-lite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuhteevah%2Frustc-lite/lists"}