Bona Fide OS Developer
View unanswered posts | View active topics It is currently Thu Mar 28, 2024 7:11 am



Post new topic Reply to topic  [ 10 posts ] 
 *.o not recongised: file format not recognised 
Author Message

Joined: Sat Jul 25, 2009 6:10 am
Posts: 112
Location: United Kingdom
Post *.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?

_________________
Thanks,
Michael Sammels

OS Developing is 10% luck, 20% skill, 15% concentrated power of will. 5% pleasure, 50% pain, and a 100% reason continue the game.


Sun Oct 25, 2009 1:35 pm
Profile

Joined: Wed Oct 14, 2009 9:39 am
Posts: 198
Location: United States
Post Re: *.o not recongised: file format not recognised
What is the format you are using? ELF or PE/COFF

_________________
Charles Timko
push %esp ;Musings of a computer addict


Sun Oct 25, 2009 7:07 pm
Profile WWW

Joined: Sat Jul 25, 2009 11:26 am
Posts: 81
Post Re: *.o not recongised: file format not recognised
".o" is not a format, rather a file extension.

Cheers,
Bogdan


Mon Oct 26, 2009 12:13 am
Profile
Site Admin

Joined: Sat Jul 25, 2009 7:44 am
Posts: 274
Location: United Kingdom
Post 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?

_________________
Thank you for reading,

Kieran C G Foot


Mon Oct 26, 2009 3:41 am
Profile WWW

Joined: Sat Jul 25, 2009 11:26 am
Posts: 81
Post 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


Mon Oct 26, 2009 4:31 am
Profile
Site Admin

Joined: Sat Jul 25, 2009 7:44 am
Posts: 274
Location: United Kingdom
Post 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.

_________________
Thank you for reading,

Kieran C G Foot


Mon Oct 26, 2009 5:02 am
Profile WWW

Joined: Sat Jul 25, 2009 11:26 am
Posts: 81
Post 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


Mon Oct 26, 2009 7:37 am
Profile

Joined: Sat Jul 25, 2009 6:10 am
Posts: 112
Location: United Kingdom
Post 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

_________________
Thanks,
Michael Sammels

OS Developing is 10% luck, 20% skill, 15% concentrated power of will. 5% pleasure, 50% pain, and a 100% reason continue the game.


Mon Oct 26, 2009 11:50 am
Profile

Joined: Sat Jul 25, 2009 11:26 am
Posts: 81
Post 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


Mon Oct 26, 2009 8:43 pm
Profile
Site Admin

Joined: Sat Jul 25, 2009 7:44 am
Posts: 274
Location: United Kingdom
Post 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.

_________________
Thank you for reading,

Kieran C G Foot


Tue Oct 27, 2009 4:54 am
Profile WWW
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 


Who is online

Users browsing this forum: No registered users and 17 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by Vjacheslav Trushkin and tweaked by the BF Team.