Skip to contentSkip to conversation

x86: clank build check adjustments

PATCH In review Jan Beulich 4 participants 9 messages Nov 15, 2019 – Dec 1, 2019

lore
Share & tools
lore
#1 lore raw

PATCH v2 1/2 x86: fix clang .macro retention check

There were two problems here: The first closing parentheses got parsed by make to end the $(call invocation, and the escaping of the quotes wasn't right either, as there's nowhere they would get un-escaped.

Furthermore there appears to be a puzzling problem with \n getting expanded to an actual newline too early in some environments. Convert these to semicolons at the same time.

---
v2: Also replace \n by semicolons.

This needs to be tested in an environment where this was actually found to matter; I can't see how it can have worked in its former shape. I also don't understand why the same commit introducing the check that gets fixed here put the .skip check in xen/Rules.mk - the only use of .skip that I can spot is in x86 code.

Config.mk +2 -0
@@ -6,6 +6,8 @@ endif
 
 # Convenient variables
 comma   := ,
+open    := (
+close   := )
 squote  := '
 #' Balancing squote, to help syntax highlighting
 empty   :=
xen/arch/x86/Rules.mk +1 -1
@@ -81,6 +81,6 @@ $(call as-option-add,CFLAGS,CC,".include
 # Check whether clang keeps .macro-s between asm()-s:
 # https://bugs.llvm.org/show_bug.cgi?id=36110
 $(call as-option-add,CFLAGS,CC,\
-                     ".macro FOO\n.endm\"); asm volatile (\".macro FOO\n.endm",\
+                     ".macro FOO;.endm"$$(close); asm volatile $$(open)".macro FOO;.endm",\
                      -no-integrated-as)
 endif

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#2 lore raw

PATCH v2 2/2 x86/clang: move and fix .skip check

In reply to Jan Beulich

From: Roger Pau Monné <[email protected]>

.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.

---
v2: Put moved check 1st in ifeq() block.

xen/Rules.mk +0 -7
@@ -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.
xen/arch/x86/Rules.mk +5 -0
@@ -74,6 +74,11 @@ ifeq ($(clang),y)
 # Note: Any test which adds -no-integrated-as will cause subsequent tests to
 # succeed, and not trigger further additions.
 
+# 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)
+
 # Check whether clang asm()-s support .include.
 $(call as-option-add,CFLAGS,CC,".include \"asm/indirect_thunk_asm.h\"",,\
                      -no-integrated-as)

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Tested-by Reviewed-by on the v2 series
#3 lore raw
In reply to Jan Beulich
Quoted 2 lines · Jan Beulich

1: fix clang .macro retention check
2: clang: move and fix .skip check

For both:

Note there's a typo in this email's subject (clank v clang). Also, if possible, could both patches have the same prefix? (x86/clang)

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Acked-by
#4 lore raw
Quoted 11 lines · Roger Pau Monné
Quoted 2 lines · Jan Beulich

1: fix clang .macro retention check
2: clang: move and fix .skip check

For both:

Note there's a typo in this email's subject (clank v clang). Also, if possible, could both patches have the same prefix? (x86/clang)

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#5 lore raw

Re: [Xen-devel] [PATCH v2 0/2] x86: clang build check adjustments

In reply to Roger Pau Monné
Quoted 8 lines · Roger Pau Monné
Quoted 2 lines · Jan Beulich

1: fix clang .macro retention check
2: clang: move and fix .skip check

For both:

[On FreeBSD and Debian 9.5]

Thanks much. I'll take the liberty and drop the seemingly stray 's' from your email address here.

Quoted 3 lines

Note there's a typo in this email's subject (clank v clang).

Yeah, I had noticed this right after sending. Fingers and brain must have had a disconnect.

Quoted 2 lines

Also, if
possible, could both patches have the same prefix? (x86/clang)

I did notice the prefix difference before sending the series. I wouldn't mind making both just x86: (moving "clang" elsewhere in the title of yours), but I don't want to make mine have x86/clang, because I think these should represent subsystems or alike.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#6 lore raw

Re: [Xen-devel] [PATCH v2 0/2] x86: clang build check adjustments

Quoted 9 lines · Jan Beulich
Quoted 2 lines · Roger Pau Monné

Also, if
possible, could both patches have the same prefix? (x86/clang)

I did notice the prefix difference before sending the series. I wouldn't mind making both just x86: (moving "clang" elsewhere in the title of yours), but I don't want to make mine have x86/clang, because I think these should represent subsystems or alike.

Oh, that's fine then. Feel free to move the 'clang' part somewhere else. Ie: 'x86: move and fix .skip clang check' LGTM for example.

Thanks.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#7 lore raw
In reply to Roger Pau Monné
Quoted 12 lines · Roger Pau Monné
Quoted 2 lines · Jan Beulich

1: fix clang .macro retention check
2: clang: move and fix .skip check

For both:

Note there's a typo in this email's subject (clank v clang). Also, if possible, could both patches have the same prefix? (x86/clang)

Roger,

Do we need to make changes to the containers that build the tree? These patches broken the clang builds in CI as can be seen here: https://gitlab.com/xen-project/xen/-/jobs/365246563#L2371

--

Doug

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#8 lore raw
Quoted 11 lines · Doug Goldstein
Quoted 9 lines · Roger Pau Monné
Quoted 2 lines · Jan Beulich

1: fix clang .macro retention check
2: clang: move and fix .skip check

For both:

Quoted 8 lines
Quoted 3 lines

Note there's a typo in this email's subject (clank v clang). Also, if possible, could both patches have the same prefix? (x86/clang)

Roger,

Do we need to make changes to the containers that build the tree? These patches broken the clang builds in CI as can be seen here:
https://gitlab.com/xen-project/xen/-/jobs/365246563#L2371

That's unexpected, the version of clang in that job is 3.5, so it should be using -no-integrated-as which is it indeed doing. Will check tomorrow to see what's going on.

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel