A Freestanding Rust Binary #997
Replies: 72 comments 37 replies
-
There is a broken link which isn't actually formatted as a link: [name mangling][mangling] |
Beta Was this translation helpful? Give feedback.
-
Thanks! Fixed in 8bd66bf. |
Beta Was this translation helpful? Give feedback.
-
Both the first and second editions of these series are invaluable. Thank you for every bit of clearly written information you’ve shared ✨ |
Beta Was this translation helpful? Give feedback.
-
@memoryruins Thanks so much! |
Beta Was this translation helpful? Give feedback.
-
The Windows subsystem information link is outdated. The page behind it is pretty much unreadable and suggests to link to here instead: https://docs.microsoft.com/en-us/cpp/build/reference/entry-entry-point-symbol |
Beta Was this translation helpful? Give feedback.
-
@CornedBee Thanks for the hint! Fixed in 6599a69. |
Beta Was this translation helpful? Give feedback.
-
In the windows part of the post, the CONSOLE subsystem entry points are used as an example, then immediately the Windows subsystems entry points are referenced, i got a feeling that some explication is missing there. |
Beta Was this translation helpful? Give feedback.
-
@AleVul Thanks for reporting! We used to define the Windows subsystem entry points and then switched to console subsystem entry points. Seems like we missed some references. Fixed in 5f12cd8. |
Beta Was this translation helpful? Give feedback.
-
Is the final code sample is supposed to build wihtout errors ? Compilator ask me to import PanicInfo |
Beta Was this translation helpful? Give feedback.
-
@sepiropht Thanks for reporting. Seems like we forgot to add the imports in the latest update. I opened #440 to fix this. |
Beta Was this translation helpful? Give feedback.
-
@phil-opp , thanks for a great series. Really well written and well explained (so much beginner-friendly). What do you think about adding the platform annotations for the trampoline functions? #[cfg(target_os = "windows")]
#[no_mangle]
pub extern "C" fn mainCRTStartup() -> ! {
main();
} |
Beta Was this translation helpful? Give feedback.
-
Thanks a lot!
These functions are just used to get a compiling no_std executable on existing operating systems in the first post. It wouldn't make sense to keep them for the subsequent posts because our OS kernel won't ever run on top of Windows or macOS. Only adding the conditional compilation for the first post would be possible, but I don't think that it's worth it because it makes things more complicated and the functions are removed in the second post anyway. |
Beta Was this translation helpful? Give feedback.
-
But you have two main() functions, one for Windows and one for MacOS. |
Beta Was this translation helpful? Give feedback.
-
@AregevDev You should only use one of the three variants, depending on your host OS. So if you're on Windows, only add the Windows-style entry point and not the Linux and macOS entry points. |
Beta Was this translation helpful? Give feedback.
-
@AregevDev An alternative approach to having os-specific entrypoints would be the introduction of a custom linker script. There, you can define the entry-point function via I think the first edition of the blog talked about it. One way or the other, you have a little piece of inconvenience. When writing a kernel, though, in the long run you will probably end up with a custom linker script at some point anyways. |
Beta Was this translation helpful? Give feedback.
-
There is a linking issue with mac, not sure if it is M1 specific, but |
Beta Was this translation helpful? Give feedback.
-
This blog is amazing, thank you so much for the concise walk through and explanations! |
Beta Was this translation helpful? Give feedback.
-
@phil-opp, is it intentional that under the original English post there's not this thread, but the thread for Russian translation instead?.. |
Beta Was this translation helpful? Give feedback.
-
I'm streaming my walkthrough of this blog series; would it be appropriate for me to share a link? |
Beta Was this translation helpful? Give feedback.
-
Would it be interesting to create a version that can run on Mac M1's |
Beta Was this translation helpful? Give feedback.
-
Thank you! Just followed the first post to the end. You were recommended by my lecturer. Learning OS Dev. |
Beta Was this translation helpful? Give feedback.
-
I am getting an error is vscode
Any idea how to solve this ? |
Beta Was this translation helpful? Give feedback.
-
excellent article, thanks to the author🤩 |
Beta Was this translation helpful? Give feedback.
-
Incase you ran into issue like below: ound duplicate lang item try this from : rust-lang/rust-analyzer#4490 (comment) works like a charm! #[cfg(not(test))] what I understood is the test crate also depends on some standard library so better to disable it. |
Beta Was this translation helpful? Give feedback.
-
Excellent. This will boost up my rust skills as well along with OS knowledge. Thanks |
Beta Was this translation helpful? Give feedback.
-
Wow! Have had an idea of creating an OS with rust before and have had really tough times. Little did i know this post existed. Thanks to all who made this possible |
Beta Was this translation helpful? Give feedback.
-
Great Guide!!! Would you consider making an update showing how to interact with the screen aside from plain text(as in writing individual pixels and clearing the screen for a full display system)? |
Beta Was this translation helpful? Give feedback.
-
Has anyone installed this onto a Pi Pico or MircoBits or other arm device? I would like to give it a try and wonder which ones were successful. |
Beta Was this translation helpful? Give feedback.
-
I shall read your text with lots of interest. But there's a question that I'm keeps disturbing my reading: any OS that I know about has parts in assembly language to cope with very specific hardware questions that higher level languages can't cope with. How will you integrate that with the protected environment that Rust intends to create ? |
Beta Was this translation helpful? Give feedback.
-
This is a general purpose comment thread for the “A Freestanding Rust Binary” post.
Beta Was this translation helpful? Give feedback.
All reactions