Ld.exe problem
-
Jamie
Ld.exe problem
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?
"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?
- Pype.Clicker
- Member

- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Ld.exe problem
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 ?
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 ?
-
Jamie
Re:Ld.exe problem
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.
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.
- Pype.Clicker
- Member

- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Ld.exe problem
i don't think DjGpp has a support for a.out files. Instead of using
try
Code: Select all
nasm -f aout kernel_start.asm -o ks.o
Code: Select all
nasm -f coff kernel_start.asm -o ks.o
- Pype.Clicker
- Member

- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Ld.exe problem
what does "ld --help" says about "supported targets" ?
-
Jamie
Re:Ld.exe problem
support targets:
coff-go32
coff-go32-exe
a.out-i386
srec
symbolsrec
tekhex
binary
ihex
coff-go32
coff-go32-exe
a.out-i386
srec
symbolsrec
tekhex
binary
ihex
- Pype.Clicker
- Member

- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Ld.exe problem
Is it a typo, or does it *really* display "ks.0" with a 'zero' or a big 'O' rather than a small 'o' ?Jamie wrote: error message "ks.0: file not recongnized: File format not recognized"
what do objdump -h ks.o say ?
-
jamie
Re:Ld.exe problem
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
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
- Pype.Clicker
- Member

- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Ld.exe problem
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 ???
I must admit that this goes beyond what i can track. Everything looks fine, except that it doesn't work ???
-
kaos
Re:Ld.exe problem
You can recompile parts of DJGPP to make it output elf files, but the default distribution as of today's date does not.
- Pype.Clicker
- Member

- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Ld.exe problem
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 ...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.
