https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65898

            Bug ID: 65898
           Summary: GCC puts auto generated code between two asm
                    volatile(".intel_syntax"); and asm
                    volatile(".att_syntax"); globally syntaxed rather than
                    not put or change it's syntax
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: inline-asm
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sstsoft at wp dot pl
  Target Milestone: ---

GCC put's code between asm volatile statements ended by new line
asm(".intel_syntax noprefix\n");
asm("mov eax,eax\n");
asm(".att_syntax\n");

so it's "auto generated" code is not well recognized by linker(?)
/APP
 # 515 "../../../some.cpp" 1
        .intel_syntax noprefix
 # 0 "" 2
        .loc 2 519 0
/NO_APP
        leal    -44(%ebp), %eax  #, tmp80
/APP
 # 519 "../../../some.cpp" 1
mov eax,%eax;    # tmp80

 # 0 "" 2
 # 519 "../../../some.cpp" 1
        .att_syntax
/NO_APP

When i write code without "\n" it's the same. I need to write in one asm();

1. GCC/GAS is not intuitive as could it be. 
Think it's little bug but then it's some kind of blocker!
2. When im forced to add .intel_syntax + code + .att_syntax at end there is a
problem with global flag -masm=intel and mixed syntaxes.
When .att code is mixed with intel asembly code global compiler flag could be
easy detected by #ifdef __INTEL_ASM and preprocessor so make decision of #ifdef
my .intel_syntaxed code with or without pre .intel statements. But if code is
mixed and pre stetemented i can't undef (change back to default syntax) because
rest of the auto generated GCC code would be ruined and not recognized.
If those statements are in one line asm() i must undef whole code either, and
this is specially when asm is in #define macro() because i can't put # in macro
 body. When i wrote asm volatile("att_syntax"); GCC sometimes put's some code
before it formated with global syntax flag and... you know what next:

"no such instruction: "

Reply via email to