{"id":13648526,"url":"https://github.com/sunfishcode/origin","last_synced_at":"2025-05-15T15:00:20.524Z","repository":{"id":189760941,"uuid":"681252846","full_name":"sunfishcode/origin","owner":"sunfishcode","description":"Program startup and thread support written in Rust","archived":false,"fork":false,"pushed_at":"2025-05-14T16:37:06.000Z","size":487,"stargazers_count":184,"open_issues_count":8,"forks_count":11,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-05-15T00:14:47.793Z","etag":null,"topics":["linux","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sunfishcode.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":"CODE_OF_CONDUCT.md","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}},"created_at":"2023-08-21T15:50:40.000Z","updated_at":"2025-04-29T20:12:38.000Z","dependencies_parsed_at":"2023-08-21T17:24:47.894Z","dependency_job_id":"40f528d4-d37a-46c8-841e-b688e3736fce","html_url":"https://github.com/sunfishcode/origin","commit_stats":{"total_commits":245,"total_committers":8,"mean_commits":30.625,"dds":0.08571428571428574,"last_synced_commit":"dfda065262077e404cd3d806ee9c93f1b6507127"},"previous_names":["sunfishcode/origin"],"tags_count":59,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunfishcode%2Forigin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunfishcode%2Forigin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunfishcode%2Forigin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunfishcode%2Forigin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sunfishcode","download_url":"https://codeload.github.com/sunfishcode/origin/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254253910,"owners_count":22039792,"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":["linux","rust"],"created_at":"2024-08-02T01:04:19.538Z","updated_at":"2025-05-15T15:00:20.491Z","avatar_url":"https://github.com/sunfishcode.png","language":"Rust","readme":"\u003cdiv align=\"center\"\u003e\n  \u003ch1\u003eOrigin\u003c/h1\u003e\n\n  \u003cp\u003e\n    \u003cstrong\u003eProgram and thread startup and shutdown in Rust\u003c/strong\u003e\n  \u003c/p\u003e\n\n  \u003cp\u003e\n    \u003ca href=\"https://github.com/sunfishcode/origin/actions?query=workflow%3ACI\"\u003e\u003cimg src=\"https://github.com/sunfishcode/origin/workflows/CI/badge.svg\" alt=\"Github Actions CI Status\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://bytecodealliance.zulipchat.com/#narrow/stream/206238-general\"\u003e\u003cimg src=\"https://img.shields.io/badge/zulip-join_chat-brightgreen.svg\" alt=\"zulip chat\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://crates.io/crates/origin\"\u003e\u003cimg src=\"https://img.shields.io/crates/v/origin.svg\" alt=\"crates.io page\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://docs.rs/origin\"\u003e\u003cimg src=\"https://docs.rs/origin/badge.svg\" alt=\"docs.rs docs\" /\u003e\u003c/a\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\nOrigin implements program startup and shutdown, as well as thread startup and\nshutdown, for Linux, implemented in Rust.\n\nProgram startup and shutdown for Linux is traditionally implemented in crt1.o,\nand the libc functions `exit`, `atexit`, and `_exit`. And thread startup and\nshutdown are traditionally implemented in libpthread functions\n`pthread_create`, `pthread_join`, `pthread_detach`, and so on. Origin provides\nits own implementations of this functionality, written in Rust.\n\nFor a C-ABI-compatible interface to this functionality, see [c-scape].\n\nThis is used by [Mustang] and [Eyra] in their libc implementations, and in the\n[Origin Studio] project in its std implementation, which are three different\nways to support building Rust programs written entirely in Rust.\n\nIt works with both stable (currently Rust \u003e= 1.85) and nightly Rust. If you're\nusing nightly Rust, enable the feature \"nightly\" to let origin use nightly-only\nfeatures, which include proper support for unwinding, better safety checks, and\nbetter optimizations.\n\n## Example crates\n\nOrigin can also be used on its own, in several different configurations:\n\n - The [basic example] shows a simple example of using Origin as a simple\n   library. In this configuration, libc is doing most of the work.\n\n - The [external-start example] uses `#![no_std]` and `#![no_main]`, and starts\n   the program by taking over control from libc as soon as possible, and then\n   hands control to Origin. Origin handles program and thread startup and\n   shutdown once it takes control.\n\n - The [origin-start example] uses `#![no_std]` and `#![no_main]`, and lets\n   Origin start the program using its own program entrypoint. Origin handles\n   program and thread startup and shutdown and no part of libc is used. This is\n   the approach that [Origin Studio] uses.\n\n - The [origin-start-no-alloc example] is like origin-start, but disables the\n   \"alloc\" and \"thread\" features, since Origin's \"thread\" feature currently\n   depends on \"alloc\". Without \"alloc\", functions that return owned strings or\n   `Vec`s are not available. In this mode, Origin avoids using a global\n   allocator entirely.\n\n - The [origin-start-lto example] is like origin-start, but builds with LTO.\n\n - The [tiny example] is like origin-start, but builds with optimization flags,\n   disables features, and adds an objcopy trick to produce a very small\n   binary—408 bytes on x86-64!\n\n## Fully static linking\n\nThe resulting executables in the origin-start, origin-start-no-alloc, and\norigin-start-lto examples don't depend on any dynamic libraries, however by\ndefault they do still depend on a dynamic linker.\n\nFor fully static linking, there are two options:\n\n - Build with\n   `RUSTFLAGS=-C target-feature=+crt-static -C relocation-model=static`. This\n   disables PIE mode, which is safer in terms of Origin's code, but loses the\n   security benefits of Address-Space Layout Randomization (ASLR).\n\n - Build with `RUSTFLAGS=-C target-feature=+crt-static` and enable Origin's\n   `experimental-relocate` feature. This allows PIE mode to work, however it\n   does so by enabling some experimental code in Origin for performing\n   relocations.\n\n[basic example]: https://github.com/sunfishcode/origin/blob/main/example-crates/basic/README.md\n[no-std example]: https://github.com/sunfishcode/origin/blob/main/example-crates/no-std/README.md\n[external-start example]: https://github.com/sunfishcode/origin/blob/main/example-crates/external-start/README.md\n[origin-start example]: https://github.com/sunfishcode/origin/blob/main/example-crates/origin-start/README.md\n[origin-start-no-alloc example]: https://github.com/sunfishcode/origin/blob/main/example-crates/origin-start-no-alloc/README.md\n[origin-start-lto example]: https://github.com/sunfishcode/origin/blob/main/example-crates/origin-start-lto/README.md\n[tiny example]: https://github.com/sunfishcode/origin/blob/main/example-crates/tiny/README.md\n[Mustang]: https://github.com/sunfishcode/mustang#readme\n[Eyra]: https://github.com/sunfishcode/eyra#readme\n[Origin Studio]: https://github.com/sunfishcode/origin-studio#readme\n[c-scape]: https://github.com/sunfishcode/c-ward/tree/main/c-scape#readme\n","funding_links":[],"categories":["Rust"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunfishcode%2Forigin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsunfishcode%2Forigin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunfishcode%2Forigin/lists"}