zaval wrote:elf files always are way bigger than plain binaries generated of them.
my initial code loader for arm, is 67 KB as elf and 2 KB as binary. and it doesn't have yet .bss. and without any alignment set.
speaking of which, don't even try to align sections on page size in elf by the way, this thing doesn't understand what file alignment and section alignment is, and literally puts those gaps in files, that makes them just huge. in fact sections in elf are just a fancy decor, because those geniuses thought that instead of using them, they will be better off to introduce an absolutely unnecessary entity, fully duplicating what sections could do - segments, turning the whole thing into pile of crap. elf format is pretty moronic honestly (first because of duplicating entities - sections and segments, second its approach to dynamic linking is braindead).
still, plain binaries are suitable only in some cases for loaders, that's all.
imo, the best approach to do dynamic linking is PE format.
67 KB vs 2 KB, that is the thing I was talking about. It wastes a lot of space.
So they are basically pre-aligned, that is both a plus (I don't have to) and a minus (space wasted).
Well I guess it is kind of outdated, but it is "simple", at least people say so. It is also very supported it seems.
Fortunately we can remove all the unnecessary sections (most of it lol).
I'll remember to take a look at PE when the times comes.
The other thing considering ELF kernels is physical memory restrictions.
My kernel is loaded at 1 MB and I have about 15 MB until I hit an ISA hole. I don't expect my kernel to grow that big (15 MB of code is a lot).
So I have a bootloader that loads a file called Kernel.elf at 1 MB but there is a problem since the file wants me to load its segments at 1 MB resulting in overwritten tables and data that I still would need in that moment to complete the loading process. I was thinking about moving it further away but that would limit my overall kernel size. (ISA hole remember?)