This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: -masm=intel examples


dewar@gnat.com (Robert Dewar) writes:
>
> But it is a fair amount of work to implement this.
>
> In fact for teaching using GCC, it would be really nice to have
> this syntax available for ASM insertions.

Using Intel syntax in asm should already work with some restrictions. 
Use something like:

asm(".intel_syntax\n"
    "code in intel syntax\n"
    ".att_syntax"); 

The only problem is that when you use %NUMBER insertions then
the compiler will still use at&t style operands (e.g. % before
registers). This could be avoided by always using absolute registers
as input and output arguments. Of course this will not generate
the best code that you can get with more flexible asm.

> Are there any text books (suitable for teaching from) that use
> AT&T syntax for Intel?

I am not aware of text books, but there is plenty of online
documentation for assembly programming under linux. This often
uses AT&T syntax. http://www.linuxassembly.org may be a good start.

-Andi


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]