X86_64 cross compiler and generating binaries
wink saville
wink@saville.com
Sat Feb 14 21:37:00 GMT 2004
Hello,
I'm looking to create a simple kernel for the Amd64 and want to make a boot
loader to start with. I have followed the instructions provided here,
http://www.nondot.org/sabre/os/files/Booting/CompilingBinaryFilesUsingACompi
ler.pdf.
I created a small program, t1.c:
int main(int argc, char *argv[])
{
int i;
int j;
for(i=0; i < 1000; i++)
{
j += 1;
}
return j;
}
When I compile this using a cross compiler created using Kegel's crosstool
(http://kegel.com/crosstool/) using the following:
gcc -c -o t1.o t1.c
ld -Ttext 0x0 -e main -o t1 t1.o
objcopy -R .note -R .comment -S -O binary t1 t1.bin
The result is:
t1.o 1256 bytes
t1 1049835 bytes
t1.bin 1048680 bytes
When I compile it with gcc 3.3.2 (Debian) using the same options
gcc -c -o t1.o t1.c
ld -Ttext 0x0 -e main -o t1 t1.o
objcopy -R .note -R .comment -S -O binary t1 t1.bin
The result is:
t1.o 699 bytes
t1 4791 bytes
t1.bin 51 bytes
Sooooo, the 1M file is a mite big, any ideas what I'm doing wrong?
Thanks,
Wink
------
Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com
More information about the crossgcc
mailing list