5 ms·
"This boot-loader, unfortunately, did not support loading any kernel images larger than 4 megabytes. This turned into a problem very quickly as it turns out tha
by soviettoly 11y ago
"This boot-loader, unfortunately, did not support loading any kernel images larger than 4 megabytes. This turned into a problem very quickly as it turns out that rustc is far less adept than gcc at creating succinct output. In fact, I was hitting this problem so early I was barely able to make a “Hello World” before having to stop working on rust code."
This really caught me. I have not played around with rust that much but having the executable be over 4MB, with such a small program such as just a Hello World is kind of nuts. I know that they still have lot of compiler optimization, but I just thought that was a very interesting portion of the read.
- scialex 11y agoThe actual kernel binary was smaller but the loader s limit was based on the amount of memory the kernel laid out in memory takes, including anonymous sections. Also turning on optimizations in rust and the linker helped a lot but were not enough in the end.
- mafribe 11y agoI guess you are the author of linked paper. Well done. I wonder if you have any opinions on how useful higher-kinded types (HKTs), one of the most requested features for Rust, would have been in implementing this OS. For example the absence of HKTs means that Rust can't have smooth and general handling of monads that is comparable to Haskell's. Would Haskell-style monads or Arrows have been helpful?
- scialex 11y agoThanks. I believe HKT would have been useful but am not really sure how much HKT would have helped me overall. They would likely have been most useful (if at all) in the VFS/S5FS/VM stages that I was unable to fully get to. Honestly, I have not used haskell enough to definitively say whether monads/arrows would have been useful.
- mafribe 11y agoI guess the only way to find out is to await the emergence of low-level languages with HKTs and then run suitable experiments.
- pjc50 11y agoAh, so all memory used by the kernel must be listed in sections loaded by the bootloader? As opposed to the normal situation where the kernel just starts grabbing it from the hardware?
- keeperofdakeys 11y agoI know no specifics of the situation, but llvm optimisations can be manually toggled through rustc. Maybe there are more special-case optimisations that could help.
- peteretep 11y ago> having the executable be over 4MB, with such a small > program such as just a Hello World is kind of nuts Presumably it's a pretty small class of program for which this is a Real World Issue.
- elihu 11y agoUnfortunately, the kinds of people who care about that sort of thing overlap heavily with rust's intended user base. Also, end users might not care that much about binary size, but distribution maintainers do -- they want to fit as much functionality they can within a reasonable-sized iso download. If including a rust program in the base OS means omitting a dozen C programs that would have fit in the same space, that's a hard sell. I am optimistic that these kinds of issues will be worked out as the language stabilizes and the tools improve.