GAS intel syntax

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
123abc

GAS intel syntax

Post by 123abc »

Hi,

I need to ask this: I have a C++ kernel, and I would like to use GAS in my inline assembly, so I need to enable the intel syntax. But I forgot the code to do so. Also, I have some inline assembly that is only for AT&T syntax, so I would like to know the command to disable intel syntax, back to AT&T.

What's the code?

Thanks
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:GAS intel syntax

Post by Pype.Clicker »

could you be precise at what you'd like to have ? GAS (gnu assembler, correct me if i'm wrong here) is natively using AT&T syntax ... i saw a trick somewhere on this board that enables the intel syntax within it ... is that what you wish ?
123abc

Re:GAS intel syntax

Post by 123abc »

Yes. I would like to know the command to enable or disable the intel syntax for GAS. Or, you could give me a link to the GAS instuction list. Thanks
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:GAS intel syntax

Post by Pype.Clicker »

i guess you'd be pleased to learn that "GAS Intel syntax" in the search button returned
http://www.mega-tokyo.com/forum/index.p ... 01;start=0

it seems that everything comes from http://www.leto.net/mail/linuxasm/2001/msg00223.html

using "strings /usr/bin/as", it seems that a ".att_syntax" command is available too.

so i guess ".att_syntax prefix" is what you want
(the "prefix" flag is for re-enabling the % prefix for the registers...)
123abc

Re:GAS intel syntax

Post by 123abc »

Ok, thanks.

But how do I disable this also? I need to because, my inportb and other stuff has some GAS AT&T syntax that it needs. How?
Thanks.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:GAS intel syntax

Post by Pype.Clicker »

pop... i think the changes in my upper post will interrest you ;)
i didn't tested it by myself, anyway :-)
123abc

Re:GAS intel syntax

Post by 123abc »

I just found that command by testing...but ty ;)
123abc

Re:GAS intel syntax

Post by 123abc »

Look what I made:

#define inasm(s) asm( ".intel_syntax" ); asm(s);asm(".att_syntax" ); // my version of GAS does not support no_prefix.

Inorder to use intel syntax with new versions of GAS with GCC, you NEED this:

#define inasm(s) asm( ".intel_syntax no_prefix" ); asm(s);asm(".att_syntax prefix" );

Example:

[main]()
{
inasm( "mov eax, 1\n
mov eax, 2\n" );
}
Post Reply