From 1a754e9af0957289ed124235d8737ac2c02a53a1 Mon Sep 17 00:00:00 2001 From: greeenboi Date: Sun, 5 Nov 2023 01:41:40 +0530 Subject: [PATCH] freestanding rust binary --- .gitignore | 1 + Cargo.lock | 7 +++++++ Cargo.toml | 14 ++++++++++++++ src/main.rs | 16 ++++++++++++++++ 4 files changed, 38 insertions(+) create mode 100644 .gitignore create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 src/main.rs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..4d578a1 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "blog_os" +version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..2873304 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "blog_os" +version = "0.1.0" +edition = "2021" +authors = ["Suvangs Ishanroy Pratyushagr"] + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[profile.dev] +panic = "abort"#disable stack unwinding on panic + +[profile.release] +panic = "abort" + +[dependencies] diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..7974bc0 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,16 @@ +#![no_std] +#![no_main] +use core::panic::PanicInfo; + + +#[panic_handler] +fn panic(_info: &PanicInfo) -> ! { + loop {} +} + + +#![no_mangle] +pub extern "C" fn _start() -> ! { + loop {} +} +