Page 1 of 1

Inline asm....

Posted: Thu Aug 03, 2006 5:59 am
by joke
if i use inline assembly in gcc of g++ , i'll have to use at&t syntax, witch is chinese to me :D . Is there an option for gcc to so that it uses nasm for inline assembly?

Posted: Thu Aug 03, 2006 6:33 am
by Mikae
I'm not sure about such abilities of gcc, but I think that you can compile asm modules using NASM or whatever do you like, and link them with other modules compiled with gcc.

Posted: Thu Aug 03, 2006 7:07 am
by chase
This is a common misconception. GAS supports intel syntex. Just add

Code: Select all

.intel_syntax noprefix
as your first inline assembly statement. The macro support and a little bit of the other syntax will still be different but it shouldn't be chinese anymore :)

Another little know fact is that you can generate intel syntax assembly from C/C++ source by using the compile options like this

Code: Select all

gcc -masm=intel -finhibit-size-directive -fverbose-asm -fleading-underscore -S -o test.asm test.c

Posted: Thu Aug 03, 2006 8:16 am
by Mikae
Oops... I was sure that gcc doesn't support it. Sorry.

Posted: Thu Aug 03, 2006 10:16 am
by joke
thank you guys, that was really helpfull,cause now i'll use gas only instead of nasm. Thank you