From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32058 invoked by alias); 19 Dec 2012 21:50:36 -0000 Received: (qmail 31894 invoked by uid 48); 19 Dec 2012 21:50:20 -0000 From: "jncronin at tysos dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug inline-asm/55744] New: Use of ebx as output register in inline asm on x86_64 PIC mcmodel=medium Date: Wed, 19 Dec 2012 21:50:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: inline-asm X-Bugzilla-Keywords: X-Bugzilla-Severity: minor X-Bugzilla-Who: jncronin at tysos dot org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-12/txt/msg01917.txt.bz2 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 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.