Created
November 23, 2014 16:28
-
-
Save arielb1/669b56620a797d41d81b to your computer and use it in GitHub Desktop.
Rust with only libcore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ rustc -C no-stack-check source.rs --crate-type=staticlib # kernel also wants -C no-redzone -C code-model=kernel | |
$ gcc libsource.a | |
$ ldd ./a.out # no rust libs here | |
linux-vdso.so.1 => (0x00007fffb5343000) | |
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f59ef69b000) | |
/lib64/ld-linux-x86-64.so.2 (0x00007f59efaa4000) | |
$ ./a.out; echo $? | |
42 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![no_std] | |
#![feature(lang_items)] | |
extern crate core; | |
#[no_mangle] pub fn main() -> uint { 42 } | |
#[lang = "stack_exhausted"] extern fn stack_exhausted() { loop {} } | |
#[lang = "eh_personality"] extern fn eh_personality() { loop {} } | |
#[lang = "panic_fmt"] fn panic_fmt() -> ! { loop {} } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment