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

Re: [Xen-devel] [PATCH 1/2] x86/clang: fix build with indirect thunks



>>> On 24.01.18 at 18:06, <roger.pau@xxxxxxxxxx> wrote:
> On Wed, Jan 24, 2018 at 09:40:40AM -0700, Jan Beulich wrote:
>> >>> On 24.01.18 at 16:48, <roger.pau@xxxxxxxxxx> wrote:
>> > The build with clang is currently broken because clang requires asm
>> > macros to be declared inside the same inline asm declaration where
>> > they are used.
>> 
>> I don't understand this: What if I have two asm()-s needing it? Does
>> this need to be done in each one? I'd expect this to result in duplicate
>> definitions on gas then (which may or may not be benign).
> 
> It's quite fun, this approach works fine with clang regardless of the
> number of asm()-s needing it. It doesn't complain about duplicate
> macros or anything. OTOH gcc complains with "Error: Macro `foo' was
> already defined".

And does clang need it in each asm()? Albeit - since the order
functions are being output is undefined, it probably should go into
each one. Hence the answer would only affect whether ...

> One option might be to guard indirect_thunk_asm.h with:
> 
> .ifndef INDIRECT_THUNK_ASM
> .equ INDIRECT_THUNK_ASM, 1
> 
> ...
> 
> .endif

... this would be needed conditionally for gas, or unconditionally.

>> > --- a/xen/Rules.mk
>> > +++ b/xen/Rules.mk
>> > @@ -66,8 +66,10 @@ endif
>> >  
>> >  AFLAGS-y                += -D__ASSEMBLY__
>> >  
>> > -# Clang's built-in assembler can't handle embedded .include's
>> > -CFLAGS-$(clang)         += -no-integrated-as
>> > +# Clang's built-in assembler doesn't understand assembler directives 
>> > without
>> > +# an absolute value:
>> > +# https://bugs.llvm.org/show_bug.cgi?id=27369 
>> > +AFLAGS-$(clang)         += -no-integrated-as
>> 
>> I also don't understand this - when you switch (back) to AFLAGS, you
>> don't affect C files.
> 
> Yes, it affects C files because now they are assembled using the
> integrated as, not the external one.
> 
>> Furthermore without using its integrated assembler
>> for C files at present - how is the build broken?
> 
> Not using the integrated as is a workaround for using the indirect
> thunk. If we can manage to get the indirect thunk to work with the
> integrated as there's no need to use the external one for C files.

Well, that'll hopefully become more clear with a more precise
description.

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®.