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

[xen stable-4.16] xen: Fix Clang -Wunicode diagnostic when building asm-macros



commit f073db0a07c5f6800a70c91819c4b8c2ba359451
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Fri Mar 3 08:15:50 2023 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Fri Mar 3 08:15:50 2023 +0100

    xen: Fix Clang -Wunicode diagnostic when building asm-macros
    
    While trying to work around a different Clang-IAS bug (parent changeset), I
    stumbled onto:
    
      In file included from arch/x86/asm-macros.c:3:
      ./arch/x86/include/asm/spec_ctrl_asm.h:144:19: error: \u used with
      no following hex digits; treating as '\' followed by identifier 
[-Werror,-Wunicode]
      .L\@_fill_rsb_loop\uniq:
                        ^
    
    It turns out that Clang -E is sensitive to the file extension of the source
    file it is processing.  Furthermore, C explicitly permits the use of \u
    escapes in identifier names, so the diagnostic would be reasonable in
    principle if we trying to compile the result.
    
    asm-macros should really have been .S from the outset, as it is ultimately
    generating assembly, not C.  Rename it, which causes Clang not to complain.
    
    We need to introduce rules for generating a .i file from .S, and 
substituting
    c_flags for a_flags lets us drop the now-redundant -D__ASSEMBLY__.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
    master commit: 53f0d02040b1df08f0589f162790ca376e1c2040
    master date: 2023-02-24 17:44:29 +0000
---
 xen/Rules.mk              | 6 ++++++
 xen/arch/x86/Makefile     | 2 +-
 xen/arch/x86/asm-macros.S | 3 +++
 xen/arch/x86/asm-macros.c | 3 ---
 4 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/xen/Rules.mk b/xen/Rules.mk
index 5e0699e58b..1f171f88e2 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -223,6 +223,9 @@ $(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): 
%.init.o: %.o FORCE
 quiet_cmd_cpp_i_c = CPP     $@
 cmd_cpp_i_c = $(CPP) $(call cpp_flags,$(c_flags)) -MQ $@ -o $@ $<
 
+quiet_cmd_cpp_i_S = CPP     $@
+cmd_cpp_i_S = $(CPP) $(call cpp_flags,$(a_flags)) -MQ $@ -o $@ $<
+
 quiet_cmd_cc_s_c = CC      $@
 cmd_cc_s_c = $(CC) $(filter-out -Wa$(comma)%,$(c_flags)) -S $< -o $@
 
@@ -232,6 +235,9 @@ cmd_cpp_s_S = $(CPP) $(call cpp_flags,$(a_flags)) -MQ $@ -o 
$@ $<
 %.i: %.c FORCE
        $(call if_changed,cpp_i_c)
 
+%.i: %.S FORCE
+       $(call if_changed,cpp_i_S)
+
 %.s: %.c FORCE
        $(call if_changed,cc_s_c)
 
diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index 69b6cfaded..8e975f472d 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -273,7 +273,7 @@ efi/buildid.o efi/relocs-dummy.o: ;
 .PHONY: include
 include: $(BASEDIR)/include/asm-x86/asm-macros.h
 
-asm-macros.i: CFLAGS-y += -D__ASSEMBLY__ -P
+asm-macros.i: CFLAGS-y += -P
 
 $(BASEDIR)/include/asm-x86/asm-macros.h: asm-macros.i Makefile
        echo '#if 0' >$@.new
diff --git a/xen/arch/x86/asm-macros.S b/xen/arch/x86/asm-macros.S
new file mode 100644
index 0000000000..891d86c765
--- /dev/null
+++ b/xen/arch/x86/asm-macros.S
@@ -0,0 +1,3 @@
+#include <asm/asm-defns.h>
+#include <asm/alternative-asm.h>
+#include <asm/spec_ctrl_asm.h>
diff --git a/xen/arch/x86/asm-macros.c b/xen/arch/x86/asm-macros.c
deleted file mode 100644
index 891d86c765..0000000000
--- a/xen/arch/x86/asm-macros.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <asm/asm-defns.h>
-#include <asm/alternative-asm.h>
-#include <asm/spec_ctrl_asm.h>
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16



 


Rackspace

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