I have been working on a software exception handler for a while and cannot get it working and I keep on getting an error that says "interrupts.o: file not recognized: File format not recognized"(interrupts.o is a assembled version of my asm file interrupt.asm). I use nasm and I linked my c files and that one asm file.
Please help.
exeption handler
Re: exeption handler
Hi,
Are you using the GCC Cross-Compiler detailed on the wiki? If so, your C files are being compiled in to 32 bit ELF object files and this is what ld also expects. You therefore need to tell your assembler to output in the same format. In nasm, you can use -f elf on the command line.
If you aren't using the GCC Cross-Compiler, you need to give more detail in the question (or start using the GCC Cross-Compiler!).
Cheers,
Adam
Edit: If you are using a 64 bit cross compiler, you would use -f elf64. For all supported nasm formats, use "nasm -hf" - basically, get NASM to output the same object file format as your compiler.
Are you using the GCC Cross-Compiler detailed on the wiki? If so, your C files are being compiled in to 32 bit ELF object files and this is what ld also expects. You therefore need to tell your assembler to output in the same format. In nasm, you can use -f elf on the command line.
If you aren't using the GCC Cross-Compiler, you need to give more detail in the question (or start using the GCC Cross-Compiler!).
Cheers,
Adam
Edit: If you are using a 64 bit cross compiler, you would use -f elf64. For all supported nasm formats, use "nasm -hf" - basically, get NASM to output the same object file format as your compiler.
Re: exeption handler
Thanks for your reply but I'm compiling it into a flat binary and I'm not using a gcc cross compiler; I'm just using the standard gcc. How would I use the -f command to compile a flat binary?
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: exeption handler
No you are not. You are compiling to an object file, you are linking object files into a flat binary. You do not want to emit flat binaries from either gcc nor nasm because you would not be able to link them afterwards.but I'm compiling it into a flat binary
Oh and, you also earned a "learn to read" complaint for the following:
andAJ's Linked page wrote:Creating a dedicated (cross-)compiler for your OS development work can save you many headaches. If ... your compiler and your assembler can't agree on binary formats
Try to make it a habit to read through all relevant and less relevant material carefully because laziness won't get you anywhere and people here are rather keen on reminding you of that.AJ wrote:For all supported nasm formats, use "nasm -hf"