Am 31.07.2017 um 19:21 hat Anatol Pomozov geschrieben: > ELF sections info is needed for an OS to map address space properly. > > I do not know much about production-grade OS but multiboot protocol is > quite popular among newly created and hobby OS. Multiboot provide some > useful information that need to be found somewhere else (e.g. by > requesting info from BIOS). > > Here is an example of Phil's Rust OS that uses multiboot to read ELF > section information. https://os.phil-opp.com/allocating-frames/ They > use GRUB that loads all ELF sections into memory and provides ELF info > via multiboot structure. > > It is interesting to see how LittleKernel tries to find the sections > information by using _start/_end markers in their linker script > https://github.com/littlekernel/lk/blob/master/arch/x86/64/kernel.ld > And while it works, in fact it just tries to recover ELF sections > information. And that is why I think it would be more useful if qemu > implemented ELF sections feature from Multiboot.
Why would you calculate something at runtime by looping through the section table when you could do this once and for all at link time? This sounds completely inefficient and is probably a bad idea. What littlekernel does is pretty much the standard way to do things. This doesn't mean that the Multiboot feature is useless, but just that the real use cases are different. Having symbol names in stack traces is one of them. And anyway, the feature is in the spec and QEMU implements this spec, so I think we don't have to discuss whether having the feature would be good. It just needs a clean implementation. Kevin