Page 1 of 1

Ld.exe problem

Posted: Tue Sep 30, 2003 8:05 am
by Jamie
when i use the command

"ld -T link.ld -o kernel.bin ks.o kernel.o" it keep getting the error message "ks.0: file not recongnized: File format not recognized"

ne1 know what i'm doing wrong and sort it?

Re:Ld.exe problem

Posted: Tue Sep 30, 2003 8:22 am
by Pype.Clicker
sounds like the output format of ks.o isn't recognized by your linker version. You should know that LD.EXE (likely to be a part of DJGPP) expect COFF files and nothing but COFF files as input.

Just make sure you're compatible with yourself, and everything should be fine ...

hint: objdump --help should tell you which output formats are supported by your implementation of binutils.

hint?: would by anychance "ks.o" be a nasmsembled file ?

Re:Ld.exe problem

Posted: Tue Sep 30, 2003 9:17 am
by Jamie
ks.o is build in nasm.

As i'm new every you you said went right of my head.
I'm trying to compile this if it helps http://osdev.neopages.net/tutorials/basickernel.php?the_id=12

i'm using nasm 0.98.38 and DJGPP.

Re:Ld.exe problem

Posted: Tue Sep 30, 2003 9:56 am
by Pype.Clicker
i don't think DjGpp has a support for a.out files. Instead of using

Code: Select all

nasm -f aout kernel_start.asm -o ks.o
try

Code: Select all

nasm -f coff kernel_start.asm -o ks.o

Re:Ld.exe problem

Posted: Tue Sep 30, 2003 10:03 am
by Jamie
Still getting the same error >:(

Re:Ld.exe problem

Posted: Tue Sep 30, 2003 10:05 am
by Pype.Clicker
what does "ld --help" says about "supported targets" ?

Re:Ld.exe problem

Posted: Tue Sep 30, 2003 10:10 am
by Jamie
support targets:

coff-go32
coff-go32-exe
a.out-i386
srec
symbolsrec
tekhex
binary
ihex

Re:Ld.exe problem

Posted: Wed Oct 01, 2003 1:32 am
by Pype.Clicker
Jamie wrote: error message "ks.0: file not recongnized: File format not recognized"
Is it a typo, or does it *really* display "ks.0" with a 'zero' or a big 'O' rather than a small 'o' ?

what do objdump -h ks.o say ?

Re:Ld.exe problem

Posted: Wed Oct 01, 2003 7:20 pm
by jamie
objdump -t ks.o :

ks.o : file format a.out-i386

Sections:

0 .text 00000008 00000000 00000000 00000000 2**3
CONTENTS, ALLOC, LOAD, RELOC, CODE
1 .data 00000000 00000008 00000008 00000028 2**3
CONTENTS, ALLOC, LOAD, DATA
2 .bss 00000000 00000008 00000008 00000000 2**3
ALLOC

Re:Ld.exe problem

Posted: Thu Oct 02, 2003 1:59 am
by Pype.Clicker
doh !? veryveryweird. maybe removing all the .o files and do a full clean compile will help you, but honestly i have a doubt. Maybe there's something corrupted with your Djgpp installation too (make sure your %PATH% environment variable is not making you use an older/different ld.exe as the one you expect, or something like this) ...

I must admit that this goes beyond what i can track. Everything looks fine, except that it doesn't work ???

Re:Ld.exe problem

Posted: Fri Oct 03, 2003 12:50 pm
by Neo
i just wanted to know does DJGPP output elf files?

Re:Ld.exe problem

Posted: Fri Oct 03, 2003 4:52 pm
by kaos
You can recompile parts of DJGPP to make it output elf files, but the default distribution as of today's date does not.

Re:Ld.exe problem

Posted: Sun Oct 05, 2003 3:14 am
by Pype.Clicker
kaos wrote: You can recompile parts of DJGPP to make it output elf files, but the default distribution as of today's date does not.
I think there is a special-ELF-release of DJGPP (or was it cygwin ? i know DF knows ;] )somewhere ... Search it hard and you should find it ...