Page 1 of 1

GAS intel syntax

Posted: Mon Dec 02, 2002 5:33 pm
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

Re:GAS intel syntax

Posted: Tue Dec 03, 2002 1:02 am
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 ?

Re:GAS intel syntax

Posted: Tue Dec 03, 2002 7:52 am
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

Re:GAS intel syntax

Posted: Tue Dec 03, 2002 9:26 am
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...)

Re:GAS intel syntax

Posted: Tue Dec 03, 2002 11:33 am
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.

Re:GAS intel syntax

Posted: Wed Dec 04, 2002 1:27 am
by Pype.Clicker
pop... i think the changes in my upper post will interrest you ;)
i didn't tested it by myself, anyway :-)

Re:GAS intel syntax

Posted: Wed Dec 04, 2002 9:47 am
by 123abc
I just found that command by testing...but ty ;)

Re:GAS intel syntax

Posted: Wed Dec 04, 2002 5:07 pm
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" );
}