Skip to content

Commit 8bd66bf

Browse files
committed
Add missing name mangling link
1 parent ae08540 commit 8bd66bf

File tree

1 file changed

+3
-1
lines changed
  • blog/content/second-edition/posts/01-freestanding-rust-binary

1 file changed

+3
-1
lines changed

blog/content/second-edition/posts/01-freestanding-rust-binary/index.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,9 @@ pub extern fn _start() -> ! {
217217
}
218218
```
219219

220-
It's important that we disable the [name mangling][mangling] through the `no_mangle` attribute, otherwise the compiler would generate some cryptic `_ZN3blog_os4_start7hb173fedf945531caE` symbol that the linker wouldn't recognize.
220+
It's important that we disable the [name mangling] through the `no_mangle` attribute, otherwise the compiler would generate some cryptic `_ZN3blog_os4_start7hb173fedf945531caE` symbol that the linker wouldn't recognize.
221+
222+
[name mangling]: https://en.wikipedia.org/wiki/Name_mangling
221223

222224
The `!` return type means that the function is diverging, i.e. not allowed to ever return. This is required because the entry point is not called by any function, but invoked directly by the operating system or bootloader. So instead of returning, the entry point should e.g. invoke the [`exit` system call] of the operating system. In our case, shutting down the machine could be a reasonable action, since there's nothing left to do if a freestanding binary returns. For now, we fulfill the requirement by looping endlessly.
223225

0 commit comments

Comments
 (0)