Skip to content

Instantly share code, notes, and snippets.

Created Jul 29, 2015
What would you like to do?
// enable features required for a "no stdlib" build
#![feature(no_std, core, lang_items)]
// generate a static library (.a)
// do not link libstd
// link libcore
extern crate core;
// export `yotz` as C-callable
pub extern fn yotz(a: i32) -> i32 {
a * 2
// runtime support functions normally provided by libstd
#[lang = "stack_exhausted"] extern fn stack_exhausted() {}
#[lang = "eh_personality"] extern fn eh_personality() {}
#[lang = "panic_fmt"] fn panic_fmt() -> ! { loop {} }
RFLAGS+= --target=x86_64-unknown-linux-musl
RFLAGS+= -C lto -C opt-level=3 -C link-args=-s -C no-redzone=yes
libhello.a: Makefile
rustc $(RFLAGS)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment