COFF Kernel size... :-(
Posted: Tue Feb 18, 2003 12:00 am
...so I write some Assembly code for a new Kernel, compile it to binary with NASM and all is well. Its approx. 300 bytes in size.
Next, I decide to write some C code. I can only compile that to a COFF object format, so I do. I have to switch NASM to compile to COFF (not the Win32 type, because the DJGPP linker doesn't like that).
I go and link it, and everything looks fine, until I look at the kernel size... 8k!!!
Where the hell did this bloat come from?!!?
The C code was a "main" function that put a value in a variable (just to see if the jump from Assembly to C worked).
Its strange how the Kernel went from 300 bytes to 8k.
The C code, at most, was 20 bytes.
I disassembled the file, and the whole thing was filled with white space, except the 300 bytes right in the middle.
Apparently all the white space is from the .data and .bss sections, which I left completely empty (except for that one variable).
Is there any way to put all this together without the unneeded bloat?
Next, I decide to write some C code. I can only compile that to a COFF object format, so I do. I have to switch NASM to compile to COFF (not the Win32 type, because the DJGPP linker doesn't like that).
I go and link it, and everything looks fine, until I look at the kernel size... 8k!!!
Where the hell did this bloat come from?!!?
The C code was a "main" function that put a value in a variable (just to see if the jump from Assembly to C worked).
Its strange how the Kernel went from 300 bytes to 8k.
The C code, at most, was 20 bytes.
I disassembled the file, and the whole thing was filled with white space, except the 300 bytes right in the middle.
Apparently all the white space is from the .data and .bss sections, which I left completely empty (except for that one variable).
Is there any way to put all this together without the unneeded bloat?