This commit is contained in:
nora 2023-09-30 23:03:43 +02:00
parent 5d8814a9eb
commit 9bfadd77d9
5 changed files with 25 additions and 110 deletions

25
README.md Normal file
View file

@ -0,0 +1,25 @@
# libuwuc
A libc implementation written in Rust.
## Layout
libuwuc consists of two crates, `libuwuc` and `rawc`. `libuwuc` is a normal Rust library
and can be unit tested. It contains all the logic. `rawc` is a wrapper that declares all
the symbols and is compiled to a staticlib/cdylib and then linked into your favourite C programs.
## How to build and test
You can build libuwuc using `cargo build`. Then, use `./uwuc-gcc` to build C programs.
`cargo test -p libuwuc` runs unit tests for the `libuwuc` crate. `./test_c.sh` runs
the bespoke integration test suite with tests written in C.
## Why
yes!!!
## Platform Support
`libuwuc` supports anything that supports the Linux system call ABI but is only tested on actual Linux.
Currently, it only supports x86-64, though that may change in the future.

View file

@ -1,72 +0,0 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "autocfg"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "cfg-if"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "example-user"
version = "0.1.0"
dependencies = [
"libuwuc",
"rawc",
]
[[package]]
name = "libuwuc"
version = "0.1.0"
dependencies = [
"cfg-if",
"linked_list_allocator",
]
[[package]]
name = "linked_list_allocator"
version = "0.10.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9afa463f5405ee81cdb9cc2baf37e08ec7e4c8209442b5d72c04cfb2cd6e6286"
dependencies = [
"spinning_top",
]
[[package]]
name = "lock_api"
version = "0.4.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16"
dependencies = [
"autocfg",
"scopeguard",
]
[[package]]
name = "rawc"
version = "0.1.0"
dependencies = [
"libuwuc",
]
[[package]]
name = "scopeguard"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]]
name = "spinning_top"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b9eb1a2f4c41445a3a0ff9abc5221c5fcd28e1f13cd7c0397706f9ac938ddb0"
dependencies = [
"lock_api",
]

View file

@ -1,18 +0,0 @@
[workspace]
[package]
name = "example-user"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[profile.dev]
panic = "abort"
[profile.release]
panic = "abort"
[dependencies]
rawc = { path = "../rawc" }
libuwuc = { path = "../libuwuc" }

View file

@ -1,17 +0,0 @@
#![feature(panic_info_message)]
#![cfg_attr(not(test), no_std)]
#![no_main]
use core::ffi::c_char;
use libuwuc::println;
extern crate rawc;
#[no_mangle]
extern "C" fn main(_argc: i32, _argv: *const *const c_char) -> i32 {
println!("Hello, world!");
let pwd = libuwuc::env::getenv(libuwuc::cstr!("PWD"));
println!("PWD={pwd:?}");
0
}

View file

@ -1,3 +0,0 @@
#!/usr/bin/env bash
cargo run --manifest-path example-user/Cargo.toml