Skip to content

Instantly share code, notes, and snippets.

@mbrubeck
Created April 28, 2017 00:59
Show Gist options
  • Save mbrubeck/8f9b933a4ffb62c243d4d36655ef419b to your computer and use it in GitHub Desktop.
Save mbrubeck/8f9b933a4ffb62c243d4d36655ef419b to your computer and use it in GitHub Desktop.
#![no_std]
#![feature(alloc_system, lang_items)]
extern crate alloc_system;
pub fn foo() -> u32 {
42
}
#[lang = "eh_personality"] extern fn eh_personality() {}
#[lang = "panic_fmt"] extern fn panic_fmt() -> ! { loop {} }
mbrubeck@p50:~/src/test$ rustc -V
rustc 1.18.0-nightly (2bd4b5c6d 2017-04-23)
mbrubeck@p50:~/src/test$ rustc -C lto --crate-type=staticlib -C opt-level=z -C panic=abort lib.rs && strip liblib.a
note: link against the following native artifacts when linking against this static library
note: the order and any duplication can be significant on some platforms, and so may need to be preserved
note: library: c
note: library: m
note: library: rt
note: library: pthread
note: library: util
mbrubeck@p50:~/src/test$ ls -lh liblib.a
-rw-r--r-- 1 mbrubeck mbrubeck 428 Apr 27 17:58 liblib.a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment