Skip to main content
GameDev.net gamedev.net
🔒 Locked

Damn COFF Kernel!!!!

Started by Ra Feb 18, 2003 at 8:40 PM 11 replies 350+ views
Original Post
Ra
Ra
...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?
[ Enter the Unspoken Realm ]
Ra
Ravuya
Ravuya
Psh, including iostream.h will yank your C programs up to a respectable size within seconds

BTW, I don''t think many people here know what a COFF is.. would you mind explaining?

Resist everyone
Talk on RavForum(tm)
elendil67
elendil67
quote:
Original post by RedSweater
WinZip solves all your compression needs!


.car format solves all of your compression needs even more!

When you go homeTell them of us, and say:For your tomorrow,We gave our today.
elendil67
elendil67
quote:
Original post by RedSweater
WinZip solves all your compression needs!


.car format solves all of your compression needs even more!

When you go homeTell them of us, and say:For your tomorrow,We gave our today.
RedBitsOfYarn
RedBitsOfYarn
Why you wascaly wabbit!

Damn you GDNET SERVER!!!!

[edited by - RedSweater on February 18, 2003 11:10:28 PM]
niyaw
niyaw
quote:
Original post by RedSweater
Damn you GDNET SERVER!!!!


gamedev tip of the day #4: doubleposting

and my stab at the question:

try reordering your segments so that their order looks like

text
data
bss

helped me when i was writing dos code.
DerekSaw
DerekSaw
quote:
Original post by Ravuya
BTW, I don''t think many people here know what a COFF is.. would you mind explaining?


A type of .OBJ file.
"after many years of singularity, i'm still searching n the event horizon" o
SHilbert
SHilbert
I''m gonna guess it''s from linking to libc. You''re gonna need an option to disable linking to libc. DJGPP is GCC-based, if I remember, so try using the ''-nostdlib'' switch.
C-Junkie
C-Junkie
I''m gonna guess that if he''s smart enough to write a kernel that boots, he''s smart enough to know that including libc is the stupidest !^@ing mistake you could make.

If its set up right, i don''t think it''d even compile...
aidan_walsh
aidan_walsh
quote:
Original post by DerekSaw
[quote]Original post by Ravuya
BTW, I don''t think many people here know what a COFF is.. would you mind explaining?


A type of .OBJ file.

Well, that cleared things right up for me. Cheers =P



#Old Steve, he said to Xerox "Boys, turn your heads and cough"
And when no-one was looking he ripped their interfaces off#
Three Dead Trolls in a Baggie on the truth behind MacOS 1

SketchSoft | SketchNews


www.aidanwalsh(.net)(.info)
Ra
Ra
C-Junkie & SHilbert: Its only Kernel code in there, I didn''t include libc or anything.. that would be psychotic.

niyaw: I already had the segments in that order. I think it still puts it in the middle, though...



[ Enter the Unspoken Realm ]
Ra

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.