[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 19.11.18 at 15:08, <andrew.cooper3@xxxxxxxxxx> wrote:
> On 19/11/2018 13:51, Jan Beulich wrote:
>>>>> On 19.11.18 at 14:11, <andrew.cooper3@xxxxxxxxxx> wrote:
>>> --- a/xen/include/xen/lib/x86/cpuid.h
>>> +++ b/xen/include/xen/lib/x86/cpuid.h
>>> @@ -20,21 +20,48 @@ struct cpuid_leaf
>>>      uint32_t a, b, c, d;
>>>  };
>>>  
>>> +/*
>>> + * Some versions of GCC are unable to cope with preserving the GOT (held in
>>> + * %ebx) around an asm() with an %ebx output constraint, and produce a 
>>> rather
>>> + * cryptic error:
>>> + *    error: inconsistent operand constraints in an ‘asm’
>>> + *
>>> + * Experimentally, 64-bit builds work correctly, and 32-bit builds on GCC 
>>> 6 or
>>> + * later work correctly.
>>> + *
>>> + * To work around the issue, use a separate register to hold the the ebx
>>> + * output, and xchg twice to leave %ebx preserved around the asm() 
>>> statement.
>>> + */
>>> +#if __PIC__ && __i386__ && __GNUC__ < 6 && !__clang__
>> I think you're missing a bunch of defined() here.
> 
> Am I?  Undefined symbols behave as if they had the value 0 in an #if

But compilers may warn in such cases. Or else there would almost
never be a need to use defined().

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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