Rust Bare Bones: Difference between revisions

[unchecked revision][unchecked revision]
Content deleted Content added
Include instructions on how to build a minimal rust ELF binary.
No edit summary
Line 18:
 
An example might be as follows (for an x86_64 platform):
<source lang="c">
{
"llvm-target": "x86_64-unknown-none",
Line 55:
First, you must prepare your source. In general, rust tries to avoid command line flags in favour of in-source changes. As such, there is not Cargo or Rust flag to disable the standard library and add a custom panic handler. The below source takes care of that:
 
<source lang="c">
#![no_std]
 
Line 73:
Another thing to keep in mind is that Rust uses stack unwinding by default, however, this is dependent on an underlying OS, which we obviously don't have (hey, you're here for a reason). To disable stack unwinding and just abort on panic (after the panic handler is called, of course), modify your Cargo.toml:
 
<source lang="c">
[profile.dev]
panic = "abort"