[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] libx86: Work around GCC bug with ebx output constrants

On Mon, 2018-11-19 at 13:29 +0000, Andrew Cooper wrote:
> On 19/11/2018 13:11, Andrew Cooper wrote:
> > Some versions of GCC can't compile cpuid.c, and fail with the rather 
> > cryptic:
> > 
> >   In file included from lib/x86/cpuid.c:3:0:
> >   lib/x86/cpuid.c: In function ‘x86_cpuid_policy_fill_native’:
> >   include/xen/lib/x86/cpuid.h:25:5: error: inconsistent operand constraints 
> > in an ‘asm’
> >        asm ( "cpuid"
> >        ^
> > 
> > In practice, this is a collision between the output constraint and the GOT
> > which is held in %ebx when compiling with -fPIC for libraries.
> > 
> > This affects at least GCC 4.9 as shipped in Debian Jessie, but 
> > experimentally
> > is fixed in GCC 6 and later.  Curiously, it only affects 32-bit builds.
> Actually, having just got GCC 5 working, that is also fine.  I'll adjust
> the wording/check, but won't bother posting a v2 if that is the only change.

I wonder if it has anything to do with this:

"Reuse of the PIC hard register, instead of using a fixed register, was
implemented on x86/x86-64 targets. This improves generated PIC code
performance as more hard registers can be used. Shared libraries can
significantly benefit from this optimization. Currently it is switched
on only for x86/x86-64 targets. As RA infrastructure is already
implemented for PIC register reuse, other targets might follow this in
the future."


Mihai Donțu

Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.