Im a newbie os developer. Indeed my problem is just linking an asm and c files. I have asm-functions called from c file and c-functions called from asm file. I have following lines and following error.
nasm -f obj vole.asm -o vole.obj
gcc -ffreestanding -c main.c -o main.o
ld -i -Tlinker.ld -o mainvole.o vole.obj main.o
Linker Error:
vole.obj: file not recognized: File format not recognized
Im using djgpp for gcc and ld.
What may the correct lines be to link this two file?
using nasm with ld
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:using nasm with ld
OBJ is a 16-bits format used by TLINK (from good 'ol TurboC) or similar MS-DOS compiler suite. LD is a 32bits linker and cannot deal with it.
So depending on whether you're under Linux or Windows, you should use "nasm -f elf" or "nasm -f coff" to get a linkable output of your .asm files...
This all (and more) should be explained in the documentation you get with nasm ...
So depending on whether you're under Linux or Windows, you should use "nasm -f elf" or "nasm -f coff" to get a linkable output of your .asm files...
This all (and more) should be explained in the documentation you get with nasm ...