Page 1 of 1

ld not recognizing A.Out

Posted: Sat Feb 05, 2005 4:20 pm
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.

Re:ld not recognizing A.Out

Posted: Mon Feb 07, 2005 4:58 am
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.