public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug inline-asm/55744] New: Use of ebx as output register in inline asm on x86_64 PIC mcmodel=medium
@ 2012-12-19 21:50 jncronin at tysos dot org
  0 siblings, 0 replies; only message in thread
From: jncronin at tysos dot org @ 2012-12-19 21:50 UTC (permalink / raw)
  To: gcc-bugs


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.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-12-19 21:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-19 21:50 [Bug inline-asm/55744] New: Use of ebx as output register in inline asm on x86_64 PIC mcmodel=medium jncronin at tysos dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).