Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Hi,
I was trying to write a little kernel in C++ using gcc, nasm and ld.
Everything works fine and my kernel can even write to screen but any of this tools wastes much space by filling the binary with about 10 kb of zero-bytes.
(That is very much if the kernel is only about 17kb all in all)
It also puts lots of NOPs into the binary although I never said so.
What can I do to prevent gcc/ld from doing this?
I think the solution lies in your linker script(if u can please show it here). Also do you strip your kernel ? It removes all debugging info but at the same time reduces kernel size.
I just found out what it was. I just copied the linker script from another project and I didn't recognize the align(4096) in round about line 60. Removing it stoped the linker from generating the zeros, but the 0x90s(nop) remained.
But I think I can live with these 20 bytes and 40 cycles overhead.