Re: [Xen-devel] [PATCH v4 2/4] x86/clang: restore integrated assembler usage with indirect thunks

2018-02-19 Thread Wei Liu
On Mon, Feb 19, 2018 at 02:16:18PM +, Roger Pau Monne wrote:
> If the required features are meet by the integrated clang assembler
   ^ met

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

Re: [Xen-devel] [PATCH v4 2/4] x86/clang: restore integrated assembler usage with indirect thunks

2018-02-19 Thread Roger Pau Monné
On Mon, Feb 19, 2018 at 08:57:15AM -0700, Jan Beulich wrote:
> >>> On 19.02.18 at 15:16,  wrote:
> > --- a/xen/arch/x86/Rules.mk
> > +++ b/xen/arch/x86/Rules.mk
> > @@ -44,3 +44,17 @@ endif
> >  
> >  # Set up the assembler include path properly for older toolchains.
> >  CFLAGS += -Wa,-I$(BASEDIR)/include
> > +
> > +ifeq ($(clang),y)
> > +# Check whether clang asm()-s support .include.
> > +ifeq ($(call as-insn,$(CC) $(CFLAGS),".include 
> > \"asm/indirect_thunk_asm.h\"",y,n),n)
> 
> Is there anything keeping you from using the slightly less ugly to use
> as-insn-check here? Oh, it's apparently that you want to use CFLAGS,
> not AFLAGS. I wonder whether the other as-insn-check uses wouldn't
> better have CFLAGS passed too. Otherwise please clarify why the
> other construct can't be used by extending the comment.

Right, it's because the .include directive is used with asm()-s in C
files so the parameters for building those use CFLAGS, not AFLAGS.

Also as-insn-check only let's you add to a variable in the success
case, and here I need to do the opposite here.

> > +CFLAGS += -no-integrated-as
> > +# Check whether clang keeps .macro-s between asm()-s:
> > +# https://bugs.llvm.org/show_bug.cgi?id=36110 
> > +else ifeq ($(if $(shell echo 'void _(void) { asm volatile ( ".macro 
> > FOO\n.endm" ); \
> 
> Careful with this; ./README still says "GNU make 3.80 or later" and
> iirc 3.80 doesn't support "else if..." on a single line.

Hm, OK, I'm afraid I don't have access to make 3.80, but I can
certainly expand this to be

else
ifeq
endif
endif

Thanks, Roger.

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

Re: [Xen-devel] [PATCH v4 2/4] x86/clang: restore integrated assembler usage with indirect thunks

2018-02-19 Thread Jan Beulich
>>> On 19.02.18 at 15:16,  wrote:
> --- a/Config.mk
> +++ b/Config.mk
> @@ -157,9 +157,9 @@ ifndef XEN_HAS_CHECKPOLICY
>  endif
>  
>  # as-insn: Check whether assembler supports an instruction.
> -# Usage: cflags-y += $(call as-insn "insn",option-yes,option-no)
> +# Usage: cflags-y += $(call as-insn cc FLAGS,"insn",option-yes,option-no)

Why lowercase cc and uppercase FLAGS? Along the lines of the
usage comment ahead of as-insn-check both should be uppercase.

> --- a/xen/arch/x86/Rules.mk
> +++ b/xen/arch/x86/Rules.mk
> @@ -44,3 +44,17 @@ endif
>  
>  # Set up the assembler include path properly for older toolchains.
>  CFLAGS += -Wa,-I$(BASEDIR)/include
> +
> +ifeq ($(clang),y)
> +# Check whether clang asm()-s support .include.
> +ifeq ($(call as-insn,$(CC) $(CFLAGS),".include 
> \"asm/indirect_thunk_asm.h\"",y,n),n)

Is there anything keeping you from using the slightly less ugly to use
as-insn-check here? Oh, it's apparently that you want to use CFLAGS,
not AFLAGS. I wonder whether the other as-insn-check uses wouldn't
better have CFLAGS passed too. Otherwise please clarify why the
other construct can't be used by extending the comment.

> +CFLAGS += -no-integrated-as
> +# Check whether clang keeps .macro-s between asm()-s:
> +# https://bugs.llvm.org/show_bug.cgi?id=36110 
> +else ifeq ($(if $(shell echo 'void _(void) { asm volatile ( ".macro 
> FOO\n.endm" ); \

Careful with this; ./README still says "GNU make 3.80 or later" and
iirc 3.80 doesn't support "else if..." on a single line.

Jan


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