Steps to create a bare-metal executable:

  • Disable standard library
  • Define custom panic handler
  • Provide language items
  • Provide entry point
  • Build executable

Hi readers, in the previous article we have covered the first three steps, and this is the continuation of these steps so here we’ll continue on rest of the steps.

As we already discussed the need for runtime for any program that needs to be executed and how Rust is different from other languages in terms of executing a program.

Alright, before jumping into the entry point section let’s understand again what we need to perform for defining an entry point in our executable.

So here in Rust, execution starts in a C runtime library called crt0, then this C runtime invokes the entry point of Rust runtime which is marked by the start language item, then the Rust runtime calls the main function.

#functional programming #rust #rust programming language

OS in Rust: An executable that runs on bare metal
1.40 GEEK