If the assembler is not used. This happens when using cc -E or cc -S
for example. GCC will just ignore the -Wa,... when the assembler is
not called, but clang will complain loudly and fail.

Also enable passing -Wa,-I$(BASEDIR)/include to clang now that it's
safe to do so.

Signed-off-by: Roger Pau Monné <roger....@citrix.com>
Cc: Jan Beulich <jbeul...@suse.com>
Cc: Andrew Cooper <andrew.coop...@citrix.com>
Cc: George Dunlap <george.dun...@eu.citrix.com>
Cc: Ian Jackson <ian.jack...@eu.citrix.com>
Cc: Konrad Rzeszutek Wilk <konrad.w...@oracle.com>
Cc: Stefano Stabellini <sstabell...@kernel.org>
Cc: Tim Deegan <t...@xen.org>
Cc: Wei Liu <wei.l...@citrix.com>
Changes since v3:
 - Filter using '-Wa,%' instead of '-Wa%' so that -Wall is not
 - Pass -Wa,-I$(BASEDIR)/include to clang also.
 xen/arch/x86/Makefile | 6 +++---
 xen/arch/x86/Rules.mk | 5 +----
 xen/include/Makefile  | 2 +-
 3 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index d903b7abb9..389096139c 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -215,15 +215,15 @@ efi/boot.init.o efi/runtime.o efi/compat.o efi/buildid.o: 
 efi/boot.init.o efi/runtime.o efi/compat.o efi/buildid.o: ;
 asm-offsets.s: $(TARGET_SUBARCH)/asm-offsets.c
-       $(CC) $(filter-out -flto,$(CFLAGS)) -S -o $@ $<
+       $(CC) $(filter-out -Wa$(comma)% -flto,$(CFLAGS)) -S -o $@ $<
 xen.lds: xen.lds.S
-       $(CC) -P -E -Ui386 $(AFLAGS) -o $@ $<
+       $(CC) -P -E -Ui386 $(filter-out -Wa$(comma)%,$(AFLAGS)) -o $@ $<
        sed -e 's/xen\.lds\.o:/xen\.lds:/g' <.xen.lds.d >.xen.lds.d.new
        mv -f .xen.lds.d.new .xen.lds.d
 efi.lds: xen.lds.S
-       $(CC) -P -E -Ui386 -DEFI $(AFLAGS) -o $@ $<
+       $(CC) -P -E -Ui386 -DEFI $(filter-out -Wa$(comma)%,$(AFLAGS)) -o $@ $<
        sed -e 's/efi\.lds\.o:/efi\.lds:/g' <.$(@F).d >.$(@F).d.new
        mv -f .$(@F).d.new .$(@F).d
diff --git a/xen/arch/x86/Rules.mk b/xen/arch/x86/Rules.mk
index 56b2ea8356..1dc5c3785a 100644
--- a/xen/arch/x86/Rules.mk
+++ b/xen/arch/x86/Rules.mk
-# Set up the assembler include path properly for older GCC toolchains.  Clang
-# objects to the agument being passed however.
-ifneq ($(clang),y)
+# Set up the assembler include path properly for older toolchains.
 CFLAGS += -Wa,-I$(BASEDIR)/include
diff --git a/xen/include/Makefile b/xen/include/Makefile
index 19066a33a0..69052ade24 100644
--- a/xen/include/Makefile
+++ b/xen/include/Makefile
@@ -65,7 +65,7 @@ compat/%.h: compat/%.i Makefile 
        mv -f $@.new $@
 compat/%.i: compat/%.c Makefile
-       $(CPP) $(filter-out -M% %.d -include %/include/xen/config.h,$(CFLAGS)) 
$(cppflags-y) -o $@ $<
+       $(CPP) $(filter-out -Wa$(comma)% -M% %.d -include 
%/include/xen/config.h,$(CFLAGS)) $(cppflags-y) -o $@ $<
 compat/%.c: public/%.h xlat.lst Makefile 
        mkdir -p $(@D)

Xen-devel mailing list

Reply via email to