This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug inline-asm/55744] New: Use of ebx as output register in inline asm on x86_64 PIC mcmodel=medium
- From: "jncronin at tysos dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 19 Dec 2012 21:50:20 +0000
- Subject: [Bug inline-asm/55744] New: Use of ebx as output register in inline asm on x86_64 PIC mcmodel=medium
- Auto-submitted: auto-generated
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.