asm-offsets: encode magic asm-offset runes as strings.
authorTim Deegan <tim@xen.org>
Thu, 3 Apr 2014 16:07:47 +0000 (18:07 +0200)
committerTim Deegan <tim@xen.org>
Thu, 24 Apr 2014 10:41:04 +0000 (11:41 +0100)
Newer versions of clang attempt to parse inline assembler even when
not asked to assemble it.  Wrap our not-for-assembly runes as strings
of the form ``.ascii "==>MAGIC RUNES<=="'' so clang doesn't choke on
them.

While we're at it, assemble more of the final output line in the C
file, to make the sed expression shorter.

Reported-by: Julien Grall <julien.grall@linaro.org>
Suggested-by: Jan Beulich <JBeulich@suse.com>
Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/Makefile
xen/arch/arm/arm32/asm-offsets.c
xen/arch/arm/arm64/asm-offsets.c
xen/arch/x86/x86_64/asm-offsets.c

index c0cf0c3741ca733b456332676704b3ace1ab132c..0e58bce91a7faf2cf6571f6907ab078c686b7c69 100644 (file)
@@ -150,7 +150,7 @@ include/asm-$(TARGET_ARCH)/asm-offsets.h: arch/$(TARGET_ARCH)/asm-offsets.s
          echo "#ifndef __ASM_OFFSETS_H__"; \
          echo "#define __ASM_OFFSETS_H__"; \
          echo ""; \
-         sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"; \
+         sed -rne "/==>/{s:.*==>(.*)<==.*:\1:; s: [\$$#]: :; p;}"; \
          echo ""; \
          echo "#endif") <$< >$@
 
index ac628c00eb3ff9f05300a55bdb963ac24f4bfd7a..cd1dff7a820b98e20900ebc5847bb511751aecd6 100644 (file)
 #include <asm/current.h>
 #include <asm/procinfo.h>
 
-#define DEFINE(_sym, _val) \
-    __asm__ __volatile__ ( "\n->" #_sym " %0 " #_val : : "i" (_val) )
-#define BLANK() \
-    __asm__ __volatile__ ( "\n->" : : )
-#define OFFSET(_sym, _str, _mem) \
+#define DEFINE(_sym, _val)                                                 \
+    asm volatile ("\n.ascii\"==>#define " #_sym " %0 /* " #_val " */<==\"" \
+                  : : "i" (_val) )
+#define BLANK()                                                            \
+    asm volatile ( "\n.ascii\"==><==\"" : : )
+#define OFFSET(_sym, _str, _mem)                                           \
     DEFINE(_sym, offsetof(_str, _mem));
 
 void __dummy__(void)
index d7572fa6502921d85f05b07d2c571b3d5cf13520..a3ce81627eb964e038fde4b7f1d9e605c34cb983 100644 (file)
 #include <public/xen.h>
 #include <asm/current.h>
 
-#define DEFINE(_sym, _val) \
-    __asm__ __volatile__ ( "\n->" #_sym " %0 " #_val : : "i" (_val) )
-#define BLANK() \
-    __asm__ __volatile__ ( "\n->" : : )
-#define OFFSET(_sym, _str, _mem) \
+#define DEFINE(_sym, _val)                                                 \
+    asm volatile ("\n.ascii\"==>#define " #_sym " %0 /* " #_val " */<==\"" \
+                  : : "i" (_val) )
+#define BLANK()                                                            \
+    asm volatile ( "\n.ascii\"==><==\"" : : )
+#define OFFSET(_sym, _str, _mem)                                           \
     DEFINE(_sym, offsetof(_str, _mem));
 
 void __dummy__(void)
index b0098b35a4664612e65a1502b0cebf18af22200a..9acb648427d325ae74975c13b607f254b6b14f67 100644 (file)
 #include <asm/hardirq.h>
 #include <xen/multiboot.h>
 
-#define DEFINE(_sym, _val) \
-    __asm__ __volatile__ ( "\n->" #_sym " %0 " #_val : : "i" (_val) )
-#define BLANK() \
-    __asm__ __volatile__ ( "\n->" : : )
-#define OFFSET(_sym, _str, _mem) \
+#define DEFINE(_sym, _val)                                                 \
+    asm volatile ("\n.ascii\"==>#define " #_sym " %0 /* " #_val " */<==\"" \
+                  : : "i" (_val) )
+#define BLANK()                                                            \
+    asm volatile ( "\n.ascii\"==><==\"" : : )
+#define OFFSET(_sym, _str, _mem)                                           \
     DEFINE(_sym, offsetof(_str, _mem));
 
 void __dummy__(void)