aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGustav Sörnäs <gustav@sornas.net>2020-11-23 14:32:44 +0100
committerGustav Sörnäs <gustav@sornas.net>2020-11-23 14:32:44 +0100
commit040bac6ad8104ce087784110ee43fc419bc03420 (patch)
treeec79769cb18d6b031a83e21c9973b59280e4022e
parent3f7102d7193d3c0f6cdda8e3106aac77188bb475 (diff)
downloadpintos-rs-040bac6ad8104ce087784110ee43fc419bc03420.tar.gz
compile rust to static library
-rw-r--r--halt/Cargo.toml5
-rw-r--r--halt/src/lib.rs (renamed from halt/src/main.rs)13
2 files changed, 8 insertions, 10 deletions
diff --git a/halt/Cargo.toml b/halt/Cargo.toml
index 160a513..14c75e0 100644
--- a/halt/Cargo.toml
+++ b/halt/Cargo.toml
@@ -4,6 +4,10 @@ version = "0.1.0"
authors = ["Gustav Sörnäs <gustav@sornas.net>"]
edition = "2018"
+[lib]
+name = "halt"
+crate-type = ["staticlib"]
+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[profile.dev]
@@ -11,6 +15,7 @@ panic = "abort"
[profile.release]
panic = "abort"
+lto = true
[dependencies.libc]
version = "0.2"
diff --git a/halt/src/main.rs b/halt/src/lib.rs
index 8abf38a..43470b2 100644
--- a/halt/src/main.rs
+++ b/halt/src/lib.rs
@@ -1,8 +1,7 @@
#![no_std]
-#![no_main]
-#![feature(start)]
//#![feature(asm)]
-//#![link_args = "-L -lmain"]
+//#![feature(link_args)]
+//#![link_args = "-L -lpintos"]
#[panic_handler]
fn panic(_info: &core::panic::PanicInfo) -> ! {
@@ -10,7 +9,7 @@ fn panic(_info: &core::panic::PanicInfo) -> ! {
}
#[no_mangle]
-pub unsafe extern "C" fn main() {
+pub unsafe extern "C" fn entry() {
exit(0x69);
}
@@ -18,9 +17,3 @@ pub unsafe extern "C" fn main() {
extern {
fn exit(status: i32);
}
-
-//#[no_mangle]
-//#[start]
-//unsafe extern "C" fn _start() {
-// exit(main());
-//}