[for-4.13] x86/clang: move and fix .skip check
diff mbox series

Message ID 20191114095927.83723-1-roger.pau@citrix.com
State New
Headers show
Series
  • [for-4.13] x86/clang: move and fix .skip check
Related show

Commit Message

Roger Pau Monné Nov. 14, 2019, 9:59 a.m. UTC
.skip is only used by x86 code, so place the clang .skip with labels
check in x86/Rules.mk instead of the top level Rules.mk. While there
also fix an issue with it by removing the '\n' which triggers the
following error:

<stdin>:1:31: error: missing terminating '"' character [-Werror,-Winvalid-pp-token]
void _(void) { asm volatile ( ".L0:
                              ^
<stdin>:1:31: error: expected string literal in 'asm'
<stdin>:3:18: error: missing terminating '"' character [-Werror,-Winvalid-pp-token]
.skip (.L1 - .L0)" ); }
                 ^
<stdin>:3:24: error: expected ')'
.skip (.L1 - .L0)" ); }
                       ^
<stdin>:1:29: note: to match this '('
void _(void) { asm volatile ( ".L0:
                            ^
<stdin>:3:24: error: expected '}'
.skip (.L1 - .L0)" ); }
                       ^
<stdin>:1:14: note: to match this '{'
void _(void) { asm volatile ( ".L0:
             ^
5 errors generated.

Suggested-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Cc: Juergen Gross <jgross@suse.com>
---
NB: will need rebasing on top of Jan's patch (or the other way
around).
---
 xen/Rules.mk          | 7 -------
 xen/arch/x86/Rules.mk | 5 +++++
 2 files changed, 5 insertions(+), 7 deletions(-)

Comments

Jan Beulich Nov. 14, 2019, 11:49 a.m. UTC | #1
On 14.11.2019 10:59, Roger Pau Monne wrote:
> .skip is only used by x86 code, so place the clang .skip with labels
> check in x86/Rules.mk instead of the top level Rules.mk. While there
> also fix an issue with it by removing the '\n' which triggers the
> following error:
> 
> <stdin>:1:31: error: missing terminating '"' character [-Werror,-Winvalid-pp-token]
> void _(void) { asm volatile ( ".L0:
>                               ^
> <stdin>:1:31: error: expected string literal in 'asm'
> <stdin>:3:18: error: missing terminating '"' character [-Werror,-Winvalid-pp-token]
> .skip (.L1 - .L0)" ); }
>                  ^
> <stdin>:3:24: error: expected ')'
> .skip (.L1 - .L0)" ); }
>                        ^
> <stdin>:1:29: note: to match this '('
> void _(void) { asm volatile ( ".L0:
>                             ^
> <stdin>:3:24: error: expected '}'
> .skip (.L1 - .L0)" ); }
>                        ^
> <stdin>:1:14: note: to match this '{'
> void _(void) { asm volatile ( ".L0:
>              ^
> 5 errors generated.

As said on the other thread - I'm afraid there's more to this difference
in un-escaping between your and my environments. I agree the newlines
aren't needed here at all, so I'd be fine to give my R-b, but we need to
fully understand the differences in observed behavior anyway.

Additionally I wonder whether you wouldn't better retain the original
sequence of checks, by placing the check you move at the beginning of
the "ifeq ($(clang),y)" block in x86/Rules.mk instead of at the end.
That'll (iirc) also better represent the history of the addition of
these checks (also demonstrated by the reference bug numbers).

Jan

Patch
diff mbox series

diff --git a/xen/Rules.mk b/xen/Rules.mk
index 3090ea7828..d1c060c3cf 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -76,13 +76,6 @@  endif
 
 AFLAGS-y                += -D__ASSEMBLY__
 
-# Older clang's built-in assembler doesn't understand .skip with labels:
-# https://bugs.llvm.org/show_bug.cgi?id=27369
-ifeq ($(clang),y)
-$(call as-option-add,CFLAGS,CC,".L0:\n.L1:\n.skip (.L1 - .L0)",,\
-                     -no-integrated-as)
-endif
-
 ALL_OBJS := $(ALL_OBJS-y)
 
 # Get gcc to generate the dependencies for us.
diff --git a/xen/arch/x86/Rules.mk b/xen/arch/x86/Rules.mk
index 659ac3d83e..328bbfea9d 100644
--- a/xen/arch/x86/Rules.mk
+++ b/xen/arch/x86/Rules.mk
@@ -83,4 +83,9 @@  $(call as-option-add,CFLAGS,CC,".include \"asm/indirect_thunk_asm.h\"",,\
 $(call as-option-add,CFLAGS,CC,\
                      ".macro FOO\n.endm\"); asm volatile (\".macro FOO\n.endm",\
                      -no-integrated-as)
+
+# Older clang's built-in assembler doesn't understand .skip with labels:
+# https://bugs.llvm.org/show_bug.cgi?id=27369
+$(call as-option-add,CFLAGS,CC,".L0: .L1: .skip (.L1 - .L0)",,\
+                     -no-integrated-as)
 endif