This is the mail archive of the gcc-bugs@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]

[Bug inline-asm/55744] New: Use of ebx as output register in inline asm on x86_64 PIC mcmodel=medium


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55744

             Bug #: 55744
           Summary: Use of ebx as output register in inline asm on x86_64
                    PIC mcmodel=medium
    Classification: Unclassified
           Product: gcc
           Version: 4.6.3
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: inline-asm
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: jncronin@tysos.org


When compiling the following with gcc for x86_64-elf-linux with -fPIC (or
-fpic) -mcmodel=medium/large the error "inconsistent operand constraints in an
'asm'" occurs.

#include <stdio.h>

int main()
{
    unsigned int a, b;
    a = 42;

    __asm__ ("movl %1, %0" : "=b" (b) : "a" (a));

    printf("Result: %d\n", b);
    return 0;
}


Changing the "=b" to "=c" fixes the problem.  As far as I can see from the
x86_64 ABI then in PIC mode with medium/large code models the r15 register
should be used to store the GOT pointer and rbx has no special meaning (unlike
i386 PIC).  Is there an error in the x86_64 machine description file where rbx
is erroneously identified as being special in PIC mode?  Or does gcc actually
make special use of rbx in this mode?

Regards,
John.


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