Mixing Assembly and C Tutorial Help

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
Cool Dude 2k
Posts: 1
Joined: Wed Jun 07, 2006 11:00 pm
Contact:

Mixing Assembly and C Tutorial Help

Post by Cool Dude 2k »

The first example works but the 2nd one gives me a error when I try to do the ld part.
Heres what I get.
cooldude2k@Game-Maker-2k:~/kernel$ nasm -f coff -o kernel32.o kernel32.asm
cooldude2k@Game-Maker-2k:~/kernel$ ld -Ttext 0x100000 --oformat binary -o kernel32.bin kernel32.o
kernel32.o: file not recognized: File format not recognized
cooldude2k@Game-Maker-2k:~/kernel$
Last edited by Cool Dude 2k on Wed Jun 07, 2006 11:00 pm, edited 1 time in total.
osprogram
Posts: 16
Joined: Tue May 09, 2006 11:00 pm

Re: Mixing Assembly and C Tutorial Help

Post by osprogram »

From the article:

Linux Warning: There is a problem with ld on Linux. The problem is that the "ld" that comes with linux distros lists support for the coff object format, but apparently you have to rebuilt binutils from gnu.org to get it working. I found two possible solutions. Recompile ld or edit your assembly files and remove all the leading underscores. Then when you assemble with nasm use the -f aout option instead of coff. I've tested the second method briefly and it works.

Sounds like this is your problem, as it looks like you're on Linux.
c_plus_plus
Posts: 1
Joined: Thu Jun 08, 2006 11:00 pm

Re: Mixing Assembly and C Tutorial Help

Post by c_plus_plus »

I have another question about this tutourial: can I use a bloodshed c++ compiler instead of the windows port for GCC
Post Reply