ld not recognizing A.Out

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
0mni

ld not recognizing A.Out

Post by 0mni »

HELP me please. enyone :-\:(:(

I am writing a kernel in c its ready to print.


but my *.o written in c won't link together with asm *.o

I used the Tutorial "Writing a Simple kernel in C" from BonaFide -> h**p://www.osdever.net/tutorials/basickernel.php?the_id=12

The Aproach is to write a c file with main in there, and an asm file from which the main function is called.
I can Compile the files into aout format with nasm without problems, same goes for the c files with gcc.

But if i try to link them like in the tutorial it wont work

ld says: ks.o: file not recognized: File format not recognized
"The ks.o is the asm file with the call made to the main(); made with nasm"

I also tried the sample sourcecode from the tutorial when i thought i had written something wrong but it wont link either.

I am Using FreeBSD 5.3 box to compile and link them

i also tried something like nasm -f aoutb for BSD aout but it didnt link either.

Please someone Help me :X i goodled and searched the forum here but I cant find someone with the saome problem :(

i use the newest nasm and ld so it cant be that the tools are too old.

8hours sitting & coding for nothing working :(

omni.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:ld not recognizing A.Out

Post by Pype.Clicker »

afaik, freeBSD is using ELF format such as other unix distributions, right (just do "file main.o" to find out). Make sure you asked nasm to produce the *same* format as what the GCC produces.

When linked together, make sure you convert the binary file to something the loader can understand. Most home-made loaders assume binary, GRUB loves ELF and BOOTF02 seems to want binary aswell.
Post Reply