Re: [Xen-devel] [PATCH v5 1/5] build: do not hardcode AFLAGS for as-insn tests

2018-02-21 Thread Andrew Cooper
On 20/02/18 14:10, Roger Pau Monne wrote:
> Hardcoding as-insn to use AFLAGS is not correct. For once the test is
> performed using a C file with inline assembly, and secondly the flags
> used can be passed by the caller together with the CC.
>
> Fix as-insn-check to pass the flags given as parameter to the test.
>
> Signed-off-by: Roger Pau Monné 
> ---
> Cc: Andrew Cooper 
> Cc: George Dunlap 
> Cc: Ian Jackson 
> Cc: Jan Beulich 
> Cc: Konrad Rzeszutek Wilk 
> Cc: Stefano Stabellini 
> Cc: Tim Deegan 
> Cc: Wei Liu 
> ---
>  Config.mk | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/Config.mk b/Config.mk
> index 51adc27d83..407472c3fc 100644
> --- 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)

Strictly speaking, this is $(call as-insn,CC FLAGS,"insn" ...

>  as-insn = $(if $(shell echo 'void _(void) { asm volatile ( $(2) ); }' \
> -   | $(1) $(filter-out -M% %.d -include 
> %/include/xen/config.h,$(AFLAGS)) \
> +   | $(filter-out -M% %.d -include 
> %/include/xen/config.h,$(1)) \
>-c -x c -o /dev/null - 2>&1),$(4),$(3))
>  
>  # as-insn-check: Add an option to compilation flags, but only if insn is
> @@ -167,7 +167,7 @@ as-insn = $(if $(shell echo 'void _(void) { asm volatile 
> ( $(2) ); }' \
>  # Usage: $(call as-insn-check CFLAGS,CC,"nop",-DHAVE_GAS_NOP)

And similarly here.  I can fix this on commit.

Acked-by: Andrew Cooper 

>  as-insn-check = $(eval $(call as-insn-check-closure,$(1),$(2),$(3),$(4)))
>  define as-insn-check-closure
> -ifeq ($$(call as-insn,$$($(2)),$(3),y,n),y)
> +ifeq ($$(call as-insn,$$($(2)) $$($(1)),$(3),y,n),y)
>  $(1) += $(4)
>  endif
>  endef


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

[Xen-devel] [PATCH v5 1/5] build: do not hardcode AFLAGS for as-insn tests

2018-02-20 Thread Roger Pau Monne
Hardcoding as-insn to use AFLAGS is not correct. For once the test is
performed using a C file with inline assembly, and secondly the flags
used can be passed by the caller together with the CC.

Fix as-insn-check to pass the flags given as parameter to the test.

Signed-off-by: Roger Pau Monné 
---
Cc: Andrew Cooper 
Cc: George Dunlap 
Cc: Ian Jackson 
Cc: Jan Beulich 
Cc: Konrad Rzeszutek Wilk 
Cc: Stefano Stabellini 
Cc: Tim Deegan 
Cc: Wei Liu 
---
 Config.mk | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Config.mk b/Config.mk
index 51adc27d83..407472c3fc 100644
--- 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)
 as-insn = $(if $(shell echo 'void _(void) { asm volatile ( $(2) ); }' \
-   | $(1) $(filter-out -M% %.d -include 
%/include/xen/config.h,$(AFLAGS)) \
+   | $(filter-out -M% %.d -include 
%/include/xen/config.h,$(1)) \
   -c -x c -o /dev/null - 2>&1),$(4),$(3))
 
 # as-insn-check: Add an option to compilation flags, but only if insn is
@@ -167,7 +167,7 @@ as-insn = $(if $(shell echo 'void _(void) { asm volatile ( 
$(2) ); }' \
 # Usage: $(call as-insn-check CFLAGS,CC,"nop",-DHAVE_GAS_NOP)
 as-insn-check = $(eval $(call as-insn-check-closure,$(1),$(2),$(3),$(4)))
 define as-insn-check-closure
-ifeq ($$(call as-insn,$$($(2)),$(3),y,n),y)
+ifeq ($$(call as-insn,$$($(2)) $$($(1)),$(3),y,n),y)
 $(1) += $(4)
 endif
 endef
-- 
2.16.1


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