Inline asm....

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
joke
Member
Member
Posts: 56
Joined: Sat Jul 22, 2006 6:20 am

Inline asm....

Post 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?
I need someone to show me the things in life that I cant find
I cant see the things that make true happiness, I must be blind
Mikae
Member
Member
Posts: 94
Joined: Sun Jul 30, 2006 1:08 pm

Post 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.
User avatar
chase
Site Admin
Posts: 710
Joined: Wed Oct 20, 2004 10:46 pm
Libera.chat IRC: chase_osdev
Location: Texas
Discord: chase/matt.heimer
Contact:

Post 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
Mikae
Member
Member
Posts: 94
Joined: Sun Jul 30, 2006 1:08 pm

Post by Mikae »

Oops... I was sure that gcc doesn't support it. Sorry.
joke
Member
Member
Posts: 56
Joined: Sat Jul 22, 2006 6:20 am

Post by joke »

thank you guys, that was really helpfull,cause now i'll use gas only instead of nasm. Thank you
I need someone to show me the things in life that I cant find
I cant see the things that make true happiness, I must be blind
Post Reply