Bona Fide OS Development
http://forums.osdever.net/

*.o not recongised: file format not recognised
http://forums.osdever.net/viewtopic.php?f=5&t=59
Page 1 of 1

Author:  Michael [ Sun Oct 25, 2009 1:35 pm ]
Post subject:  *.o not recongised: file format not recognised

I seem to get this while compiling my Operating System (when linking kernel_start.o). I think it's the ld software, because it happens with many different examples over the net. Any ideas?

Author:  ctimko [ Sun Oct 25, 2009 7:07 pm ]
Post subject:  Re: *.o not recongised: file format not recognised

What is the format you are using? ELF or PE/COFF

Author:  Love4Boobies [ Mon Oct 26, 2009 12:13 am ]
Post subject:  Re: *.o not recongised: file format not recognised

".o" is not a format, rather a file extension.

Cheers,
Bogdan

Author:  Kieran [ Mon Oct 26, 2009 3:41 am ]
Post subject:  Re: *.o not recongised: file format not recognised

Bogdan, the *.o file type, is a file format, but it is a format that contains an intermediate object, which is usually linked to form a complete program.

What is the command line you are using to compile the *.o files?
Also, what is the platform you are compiling/linking on?

Author:  Love4Boobies [ Mon Oct 26, 2009 4:31 am ]
Post subject:  Re: *.o not recongised: file format not recognised

Nope, it's just an extension. It can be used with any format from a.out to ELF and COFF.

Cheers,
Bogdan

Author:  Kieran [ Mon Oct 26, 2009 5:02 am ]
Post subject:  Re: *.o not recongised: file format not recognised

Yes, exactly, the .o on the end of the file just denotes the fact that the file contains object data, regardless of its internal format.

Author:  Love4Boobies [ Mon Oct 26, 2009 7:37 am ]
Post subject:  Re: *.o not recongised: file format not recognised

Exactly. I wanted to clarify this because if the error spat by the linker is anything like the one in the thread title then I suspect the OP didn't make this difference and passed "*.o" as the format instead of say, ELF. I've seen people do this before; just making sure it's not the case.

Cheers,
Bogdan

Author:  Michael [ Mon Oct 26, 2009 11:50 am ]
Post subject:  Re: *.o not recongised: file format not recognised

Please stop arguing about the way I code please. :P

Code:
gcc -c  -nostartfiles -nostdlib -nostdinc -I ../include ../kernel/main.c -o kernel.o
nasm -f aout ../kernel/start.asm -o start.o
ld -T link.ld -o kernel.sys start.o kernel.o

Author:  Love4Boobies [ Mon Oct 26, 2009 8:43 pm ]
Post subject:  Re: *.o not recongised: file format not recognised

We weren't arguing. What was GCC configured for? If it was configured for ELF then you're trying to link an a.out with an ELF which will never work. Also, "-nostartfiles" means "-nostdlib" + "-nostdinc".

Cheers,
Bogdan

Author:  Kieran [ Tue Oct 27, 2009 4:54 am ]
Post subject:  Re: *.o not recongised: file format not recognised

Hmm, you know I didnt think of that Bogdan.

Michael mate, build a cross-compiler for your platform, do both GCC and BinUtils so you know they will work together, there is a tutorial on OSDev.org on how to do this.

I used to have this same problem when I used DJGPP, but the actual error was a bit more obscure then yours, but it boiled down to the same problem.

Page 1 of 1 All times are UTC - 6 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/