ld & Compiled asm?
ld & Compiled asm?
Alright, I'm working on building my own OS, and this just happens to be the first time I've stepped out of the Visual Studio development box. I'm currently having an issue with ld. It works fine until I include my compiled assembly(named start.o, compiled with nasm). It claims to not recognize the file type. Any help?
Re:ld & Compiled asm?
Check your file type in nasm (-f parameter IIRC), depending on what GCC/LD you are currently using (Cross Compiler with ELF, Cygwin, DJGPP) you will need a different format, ELF is "-f elf", Cygwin is "-f coff", DJGPP should be "-f coff" as well but I'm not sure if it works correctly.
Re:ld & Compiled asm?
Alright, tried both of those, and neither worked. Here's the commands I'm issuing to build everything:
nasm -f aout -o start.o start.asm
gcc -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o main.o main.c
gcc -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o scrn.o scrn.c
gcc -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o gdt.o gdt.c
gcc -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o idt.o idt.c
gcc -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o isrs.o isrs.c
gcc -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o irq.o irq.c
gcc -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o timer.o timer.c
gcc -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o kb.o kb.c
ld -T link.ld -o kernel.bin start.o main.o scrn.o gdt.o idt.o isrs.o irq.o timer.o kb.o
Re:ld & Compiled asm?
Are you using windows (cygwin or djgpp) or linux? Maybe try to get another version of nasm, that helped me when I had the same problems.
Re:ld & Compiled asm?
"nasm -f aout -o start.o start.asm" != "nasm -f elf -o start.o start.asm"
Re:ld & Compiled asm?
Nobody ever said that I wanted an elf format...guest wrote: "nasm -f aout -o start.o start.asm" != "nasm -f elf -o start.o start.asm"
Re:ld & Compiled asm?
Code: Select all
nasm -f coff -o start.o start.asm
nasm -f gnuwin32 -o start.o start.asm