clang fixes
v4 cover clang fixes
Hello,
The following series re-enable the integrated clang assembler when the features required in order to build Xen are available.
First 2 patches remove the unconditional addition of -no-integrated-as to CFLAGS (only adding it to AFLAGS like it was done before). Finally patches 3 and 4 remove the usage of -no-integrated-as from AFLAGS when possible.
This series has been tested with clang 6 (without -no-integrated-as), clang 3.5 and gcc 6.
Thanks, Roger.
Roger Pau Monne (4):
build: filter out command line assembler arguments x86/clang: restore integrated assembler usage with indirect thunks
x86: fix indirect thunk usage of CONFIG_INDIRECT_THUNK build/clang: add a check whether the assembler supports .skip with
labels
Config.mk | 6 +++--- xen/Rules.mk | 9 +++++++-- xen/arch/x86/Makefile | 6 +++--- xen/arch/x86/Rules.mk | 17 ++++++++++++++--- xen/include/Makefile | 2 +- xen/include/asm-x86/indirect_thunk_asm.h | 4 ++++ 6 files changed, 32 insertions(+), 12 deletions(-)
Signature · 7 lines
2.16.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v4 1/4 build: filter out command line assembler arguments
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.
---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Ian Jackson <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Tim Deegan <[email protected]>
Cc: Wei Liu <[email protected]>
---
Changes since v3:
- Filter using '-Wa,%' instead of '-Wa%' so that -Wall is not matched.
- 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(-)
xen/arch/x86/Makefile +3 -3
@@ -215,15 +215,15 @@ efi/boot.init.o efi/runtime.o efi/compat.o efi/buildid.o: $(BASEDIR)/arch/x86/ef 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
xen/arch/x86/Rules.mk +1 -4
@@ -42,8 +42,5 @@ CFLAGS += -DCONFIG_INDIRECT_THUNK export CONFIG_INDIRECT_THUNK=y endif -# 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 -endif
xen/include/Makefile +1 -1
@@ -65,7 +65,7 @@ compat/%.h: compat/%.i Makefile $(BASEDIR)/tools/compat-build-header.py mv -f [email protected] $@ 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 $(BASEDIR)/tools/compat-build-source.py mkdir -p $(@D)
Signature · 7 lines
2.16.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v4 1/4] build: filter out command line assembler arguments
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 19.02.18 at 15:16, <[email protected]> wrote:
--- xen/arch/x86/Makefile | 6 +++--- xen/arch/x86/Rules.mk | 5 +---- xen/include/Makefile | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-)
What about the "%.i: %.c", "%.s: %.c", and "%.s: %.S" rules near the end of xen/Rules.mk?
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v4 1/4] build: filter out command line assembler arguments
Quoted 9 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 19.02.18 at 15:16, <[email protected]> wrote:
--- xen/arch/x86/Makefile | 6 +++--- xen/arch/x86/Rules.mk | 5 +---- xen/include/Makefile | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-)What about the "%.i: %.c", "%.s: %.c", and "%.s: %.S" rules near the end of
xen/Rules.mk?
Hm, those rules don't seem to be used at all in x86, are they not needed anymore because there are more specific rules instead?
I can add the filtering there, but maybe it would be better to simply remove those?
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v4 1/4] build: filter out command line assembler arguments
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 19.02.18 at 17:05, <[email protected]> wrote:
Quoted 7 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 19.02.18 at 15:16, <[email protected]> wrote:
--- xen/arch/x86/Makefile | 6 +++--- xen/arch/x86/Rules.mk | 5 +---- xen/include/Makefile | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-)
Quoted 8 lines
Quoted 2 lines
What about the "%.i: %.c", "%.s: %.c", and "%.s: %.S" rules near the end of
xen/Rules.mk?Hm, those rules don't seem to be used at all in x86, are they not needed anymore because there are more specific rules instead?
I can add the filtering there, but maybe it would be better to simply remove those?
No, don't, ever. They're not needed for a _normal_ build, but in case of build problems they may be needed for analyzing the issue, i.e. when you need to look at one of the intermediate files. I happen to use this every once in a while, especially when macro invocations nest so deeply that the compiler doesn't produce useful location information anymore.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v4 1/4] build: filter out command line assembler arguments
Quoted 18 lines · Jan Beulich
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 19.02.18 at 17:05, <[email protected]> wrote:
Quoted 7 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 19.02.18 at 15:16, <[email protected]> wrote:
--- xen/arch/x86/Makefile | 6 +++--- xen/arch/x86/Rules.mk | 5 +---- xen/include/Makefile | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-)Quoted 8 lines
Quoted 2 lines
What about the "%.i: %.c", "%.s: %.c", and "%.s: %.S" rules near the end of
xen/Rules.mk?Hm, those rules don't seem to be used at all in x86, are they not needed anymore because there are more specific rules instead?
I can add the filtering there, but maybe it would be better to simply remove those?
Quoted 6 lines
No, don't, ever. They're not needed for a _normal_ build, but in case of build problems they may be needed for analyzing the issue, i.e. when you need to look at one of the intermediate files. I happen to use this every once in a while, especially when macro invocations nest so deeply that the compiler doesn't produce useful location information anymore.
Oh, OK, thanks for the clarification. I'm adding the filtering there then.
Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v4 2/4 x86/clang: restore integrated assembler usage with indirect thunks
In reply to Roger Pau MonneIf the required features are meet by the integrated clang assembler (support for .includes and propagation of .macro-s between asm()-s) do not disable it.
Only switch off the non integrated assembler for assembly file, like it was done prior to "x86: Support indirect thunks from assembly code".
---
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Tim Deegan <[email protected]>
Cc: Wei Liu <[email protected]>
---
Changes since v3:
- Do not modify how the thunk is included, clang upstream (and 6) has been fixed to propagate .macro-s between asm()-s.
Changes since v1:
- Use as-insn to check if the assembler supports .include.
- Open code a check for whether the assembler forgets .macro-s between asm()-s.
--- Config.mk | 6 +++--- xen/Rules.mk | 5 +++-- xen/arch/x86/Rules.mk | 14 ++++++++++++++ 3 files changed, 20 insertions(+), 5 deletions(-)
Config.mk +3 -3
@@ -157,9 +157,9 @@ ifndef XEN_HAS_CHECKPOLICY endif # as-insn: Check whether assembler supports an instruction. -# Usage: cflags-y += $(call as-insn "insn",option-yes,option-no) +# Usage: cflags-y += $(call as-insn cc FLAGS,"insn",option-yes,option-no) as-insn = $(if $(shell echo 'void _(void) { asm volatile ( $(2) ); }' \ - | $(1) $(filter-out -M% %.d -include %/include/xen/config.h,$(AFLAGS)) \ + | $(filter-out -M% %.d -include %/include/xen/config.h,$(1)) \ -c -x c -o /dev/null - 2>&1),$(4),$(3)) # as-insn-check: Add an option to compilation flags, but only if insn is
@@ -167,7 +167,7 @@ as-insn = $(if $(shell echo 'void _(void) { asm volatile ( $(2) ); }' \ # Usage: $(call as-insn-check CFLAGS,CC,"nop",-DHAVE_GAS_NOP) as-insn-check = $(eval $(call as-insn-check-closure,$(1),$(2),$(3),$(4))) define as-insn-check-closure - ifeq ($$(call as-insn,$$($(2)),$(3),y,n),y) + ifeq ($$(call as-insn,$$($(2)) $$(AFLAGS),$(3),y,n),y) $(1) += $(4) endif endef
xen/Rules.mk +3 -2
@@ -70,8 +70,9 @@ endif AFLAGS-y += -D__ASSEMBLY__ -# Clang's built-in assembler can't handle embedded .include's -CFLAGS-$(clang) += -no-integrated-as +# Older clang's built-in assembler doesn't understand .skip with labels: +# https://bugs.llvm.org/show_bug.cgi?id=27369 +AFLAGS-$(clang) += -no-integrated-as ALL_OBJS := $(ALL_OBJS-y)
xen/arch/x86/Rules.mk +14 -0
@@ -44,3 +44,17 @@ endif # Set up the assembler include path properly for older toolchains. CFLAGS += -Wa,-I$(BASEDIR)/include + +ifeq ($(clang),y) + # Check whether clang asm()-s support .include. + ifeq ($(call as-insn,$(CC) $(CFLAGS),".include \"asm/indirect_thunk_asm.h\"",y,n),n) + CFLAGS += -no-integrated-as + # Check whether clang keeps .macro-s between asm()-s: + # https://bugs.llvm.org/show_bug.cgi?id=36110 + else ifeq ($(if $(shell echo 'void _(void) { asm volatile ( ".macro FOO\n.endm" ); \ + asm volatile ( ".macro FOO\n.endm" ); }' \ + | $(CC) $(filter-out -M% %.d -include %/include/xen/config.h,$(CFLAGS)) \ + -c -x c -o /dev/null - 2>&1),n,y),y) + CFLAGS += -no-integrated-as + endif +endif
Signature · 7 lines
2.16.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v4 2/4] x86/clang: restore integrated assembler usage with indirect thunks
Config.mk ifndef XEN_HAS_CHECKPOLICY · line 160
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 19.02.18 at 15:16, <[email protected]> wrote:
Config.mk +1
-1@@ -157,9 +157,9 @@ ifndef XEN_HAS_CHECKPOLICY endif # as-insn: Check whether assembler supports an instruction. -# Usage: cflags-y += $(call as-insn "insn",option-yes,option-no) +# Usage: cflags-y += $(call as-insn cc FLAGS,"insn",option-yes,option-no)
Why lowercase cc and uppercase FLAGS? Along the lines of the usage comment ahead of as-insn-check both should be uppercase.
xen/arch/x86/Rules.mk endif · line 50
Quoted 10 lines
xen/arch/x86/Rules.mk +4
-0@@ -44,3 +44,17 @@ endif # Set up the assembler include path properly for older toolchains. CFLAGS += -Wa,-I$(BASEDIR)/include + +ifeq ($(clang),y) + # Check whether clang asm()-s support .include. + ifeq ($(call as-insn,$(CC) $(CFLAGS),".include \"asm/indirect_thunk_asm.h\"",y,n),n)
Is there anything keeping you from using the slightly less ugly to use as-insn-check here? Oh, it's apparently that you want to use CFLAGS, not AFLAGS. I wonder whether the other as-insn-check uses wouldn't better have CFLAGS passed too. Otherwise please clarify why the other construct can't be used by extending the comment.
xen/arch/x86/Rules.mk endif · line 54
Quoted 4 lines
xen/arch/x86/Rules.mk +4
-0+ CFLAGS += -no-integrated-as + # Check whether clang keeps .macro-s between asm()-s: + # https://bugs.llvm.org/show_bug.cgi?id=36110 + else ifeq ($(if $(shell echo 'void _(void) { asm volatile ( ".macro FOO\n.endm" ); \
Careful with this; ./README still says "GNU make 3.80 or later" and iirc 3.80 doesn't support "else if..." on a single line.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v4 2/4] x86/clang: restore integrated assembler usage with indirect thunks
Quoted 5 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 19.02.18 at 15:16, <[email protected]> wrote:
xen/arch/x86/Rules.mk +0
-0@@ -44,3 +44,17 @@ endif
Quoted 12 lines
xen/arch/x86/Rules.mk endif · line 50
Quoted 6 lines
xen/arch/x86/Rules.mk +4
-0# Set up the assembler include path properly for older toolchains. CFLAGS += -Wa,-I$(BASEDIR)/include + +ifeq ($(clang),y) + # Check whether clang asm()-s support .include. + ifeq ($(call as-insn,$(CC) $(CFLAGS),".include \"asm/indirect_thunk_asm.h\"",y,n),n)Is there anything keeping you from using the slightly less ugly to use as-insn-check here? Oh, it's apparently that you want to use CFLAGS, not AFLAGS. I wonder whether the other as-insn-check uses wouldn't better have CFLAGS passed too. Otherwise please clarify why the other construct can't be used by extending the comment.
Right, it's because the .include directive is used with asm()-s in C files so the parameters for building those use CFLAGS, not AFLAGS.
Also as-insn-check only let's you add to a variable in the success case, and here I need to do the opposite here.
Quoted 7 lines
xen/arch/x86/Rules.mk endif · line 54
Quoted 4 lines
xen/arch/x86/Rules.mk +4
-0+ CFLAGS += -no-integrated-as + # Check whether clang keeps .macro-s between asm()-s: + # https://bugs.llvm.org/show_bug.cgi?id=36110 + else ifeq ($(if $(shell echo 'void _(void) { asm volatile ( ".macro FOO\n.endm" ); \Careful with this; ./README still says "GNU make 3.80 or later" and iirc 3.80 doesn't support "else if..." on a single line.
Hm, OK, I'm afraid I don't have access to make 3.80, but I can certainly expand this to be
else
ifeq
endif
endif
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v4 2/4] x86/clang: restore integrated assembler usage with indirect thunks
In reply to Roger Pau MonneQuoted 1 line · Roger Pau Monne
If the required features are meet by the integrated clang assembler
^ met
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v4 3/4 x86: fix indirect thunk usage of CONFIG_INDIRECT_THUNK
In reply to Roger Pau MonneWhen indirect_thunk_asm.h is instantiated directly into assembly files CONFIG_INDIRECT_THUNK might not be defined, and thus using .if against it is wrong.
Add a check to define CONFIG_INDIRECT_THUNK to 0 if not defined, so that using .if CONFIG_INDIRECT_THUNK is always correct.
This suppresses the following clang error:
<instantiation>:8:9: error: expected absolute expression
.if CONFIG_INDIRECT_THUNK == 1
^<instantiation>:1:1: note: while in macro instantiation INDIRECT_BRANCH call %rdx
^
entry.S:589:9: note: while in macro instantiation
INDIRECT_CALL %rdx
^---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
--- xen/include/asm-x86/indirect_thunk_asm.h | 4 ++++ 1 file changed, 4 insertions(+)
xen/include/asm-x86/indirect_thunk_asm.h +4 -0
@@ -3,6 +3,10 @@* usual #ifdef'ary to turn into comments. */ +.ifndef CONFIG_INDIRECT_THUNK + .equ CONFIG_INDIRECT_THUNK, 0 +.endif + .macro INDIRECT_BRANCH insn:req arg:req/* * Create an indirect branch. insn is one of call/jmp, arg is a single
Signature · 7 lines
2.16.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v4 3/4] x86: fix indirect thunk usage of CONFIG_INDIRECT_THUNK
Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 19.02.18 at 15:16, <[email protected]> wrote:
When
indirect_thunk_asm.his instantiated directly into assembly filesCONFIG_INDIRECT_THUNKmight not be defined, and thus using .if against it is wrong.Add a check to define
CONFIG_INDIRECT_THUNKto 0 if not defined, so that using .ifCONFIG_INDIRECT_THUNKis always correct.This suppresses the following clang error:
<instantiation>:8:9: error: expected absolute expression
.if CONFIG_INDIRECT_THUNK == 1 ^
Quoted 8 lines
<instantiation>:1:1: note: while in macro instantiation
INDIRECT_BRANCHcall %rdx
^
entry.S:589:9: note: while in macro instantiationINDIRECT_CALL %rdx ^Signed-off-by Roger Pau Monné <[email protected]>
As said previously I'm not overly happy about this, but still
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v4 3/4] x86: fix indirect thunk usage of CONFIG_INDIRECT_THUNK
In reply to Roger Pau Monnexen/include/asm-x86/indirect_thunk_asm.h line 8
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 19.02.18 at 15:16, <[email protected]> wrote:
xen/include/asm-x86/indirect_thunk_asm.h +3
-0@@ -3,6 +3,10 @@* usual #ifdef'ary to turn into comments. */ +.ifndef CONFIG_INDIRECT_THUNK + .equ CONFIG_INDIRECT_THUNK, 0 +.endif
I have to withdraw my R-b: This fails to build (I'm getting an error on the .ifndef above for more than one assembler source). I assume that's because with indirect thunks enabled the constant gets replaced by literal 1 by the C preprocessor.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v4 3/4] x86: fix indirect thunk usage of CONFIG_INDIRECT_THUNK
Quoted 7 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 19.02.18 at 15:16, <[email protected]> wrote:
xen/include/asm-x86/indirect_thunk_asm.h +0
-0@@ -3,6 +3,10 @@* usual #ifdef'ary to turn into comments. */
Quoted 8 lines
xen/include/asm-x86/indirect_thunk_asm.h line 8
Quoted 3 lines
xen/include/asm-x86/indirect_thunk_asm.h +3
-0+.ifndef CONFIG_INDIRECT_THUNK + .equ CONFIG_INDIRECT_THUNK, 0 +.endifI have to withdraw my R-b: This fails to build (I'm getting an error on the .ifndef above for more than one assembler source). I assume that's because with indirect thunks enabled the constant gets replaced by literal 1 by the C preprocessor.
Right, I've just installed gcc7-devel and I'm seeing the same. Thanks for noticing. Let me try to solve this in another way...
Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v4 3/4] x86: fix indirect thunk usage of CONFIG_INDIRECT_THUNK
Quoted 17 lines · Roger Pau Monné
Quoted 7 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 19.02.18 at 15:16, <[email protected]> wrote:
xen/include/asm-x86/indirect_thunk_asm.h +0
-0@@ -3,6 +3,10 @@* usual #ifdef'ary to turn into comments. */ Quoted 8 lines
xen/include/asm-x86/indirect_thunk_asm.h line 8
Quoted 3 lines
xen/include/asm-x86/indirect_thunk_asm.h +3
-0+.ifndef CONFIG_INDIRECT_THUNK + .equ CONFIG_INDIRECT_THUNK, 0 +.endifI have to withdraw my R-b: This fails to build (I'm getting an error on the .ifndef above for more than one assembler source). I assume that's because with indirect thunks enabled the constant gets replaced by literal 1 by the C preprocessor.
Quoted 2 lines
Right, I've just installed gcc7-devel and I'm seeing the same. Thanks for noticing. Let me try to solve this in another way...
So far the best way I've found to solve this issue that works with both gcc (with and without indirect thunk support) and clang is the following:
xen/include/asm-x86/asm_defns.h +3 -0
@@ -15,6 +15,9 @@#include <asm/alternative.h> #ifdef __ASSEMBLY__ +#ifndef CONFIG_INDIRECT_THUNK +.equ CONFIG_INDIRECT_THUNK, 0 +#endif # include <asm/indirect_thunk_asm.h> #else asm ( "\t.equ CONFIG_INDIRECT_THUNK, "
It's fairly similar to my first approach, but at least "#ifdef CONFIG_INDIRECT_THUNK" will still work as expected after this fix.
Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v4 3/4] x86: fix indirect thunk usage of CONFIG_INDIRECT_THUNK
Quoted 14 lines
Quoted 1 line
Quoted 1 line · On 20.02.18 at 12:01, <[email protected]> wrote:
xen/include/asm-x86/asm_defns.h +3
-0@@ -15,6 +15,9 @@#include <asm/alternative.h> #ifdef __ASSEMBLY__ +#ifndef CONFIG_INDIRECT_THUNK +.equ CONFIG_INDIRECT_THUNK, 0 +#endif # include <asm/indirect_thunk_asm.h> #else asm ( "\t.equ CONFIG_INDIRECT_THUNK, "
Quoted 2 lines
It's fairly similar to my first approach, but at least "#ifdef
CONFIG_INDIRECT_THUNK" will still work as expected after this fix.
I've used something similar in backports to old versions, so I wonder whether what you quote above is right: Assembly files don't get handed to clang anyway iirc, so the change would seem to be needed in the #else part of the conditional.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v4 3/4] x86: fix indirect thunk usage of CONFIG_INDIRECT_THUNK
Quoted 14 lines · Jan Beulich
Quoted 14 lines
Quoted 1 line
Quoted 1 line · On 20.02.18 at 12:01, <[email protected]> wrote:
xen/include/asm-x86/asm_defns.h +3
-0@@ -15,6 +15,9 @@#include <asm/alternative.h> #ifdef __ASSEMBLY__ +#ifndef CONFIG_INDIRECT_THUNK +.equ CONFIG_INDIRECT_THUNK, 0 +#endif # include <asm/indirect_thunk_asm.h> #else asm ( "\t.equ CONFIG_INDIRECT_THUNK, "
Quoted 7 lines
Quoted 2 lines
It's fairly similar to my first approach, but at least "#ifdef
CONFIG_INDIRECT_THUNK" will still work as expected after this fix.I've used something similar in backports to old versions, so I wonder whether what you quote above is right: Assembly files don't get handed to clang anyway iirc, so the change would seem to be needed in the #else part of the conditional.
Assembly files do get handed to clang, from xen/Rules.mk:
%.o: %.S Makefile
$(CC) $(AFLAGS) -c $< -o $@
Xen doesn't call as directly to compile those, or am I missing something?
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v4 3/4] x86: fix indirect thunk usage of CONFIG_INDIRECT_THUNK
Quoted 24 lines
Quoted 1 line
Quoted 1 line · On 20.02.18 at 12:22, <[email protected]> wrote:
Quoted 14 lines · Jan Beulich
Quoted 14 lines
Quoted 1 line
Quoted 1 line · On 20.02.18 at 12:01, <[email protected]> wrote:
xen/include/asm-x86/asm_defns.h +3
-0@@ -15,6 +15,9 @@#include <asm/alternative.h> #ifdef __ASSEMBLY__ +#ifndef CONFIG_INDIRECT_THUNK +.equ CONFIG_INDIRECT_THUNK, 0 +#endif # include <asm/indirect_thunk_asm.h> #else asm ( "\t.equ CONFIG_INDIRECT_THUNK, "Quoted 7 lines
Quoted 2 lines
It's fairly similar to my first approach, but at least "#ifdef
CONFIG_INDIRECT_THUNK" will still work as expected after this fix.I've used something similar in backports to old versions, so I wonder whether what you quote above is right: Assembly files don't get handed to clang anyway iirc, so the change would seem to be needed in the #else part of the conditional.
Quoted 7 lines
Assembly files do get handed to clang, from
xen/Rules.mk:%.o: %.S
Makefile$(CC) $(AFLAGS) -c $< -o $@Xen doesn't call as directly to compile those, or am I missing something?
Oh, I was referring to the -mno-integrated-as (or whatever it's called) option. "Handed to clang" wasn't the best way to put it, I agree. But it's clang's integrated assembler which the problem is with.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v4 3/4] x86: fix indirect thunk usage of CONFIG_INDIRECT_THUNK
Quoted 29 lines · Jan Beulich
Quoted 29 lines
Quoted 1 line
Quoted 1 line · On 20.02.18 at 12:22, <[email protected]> wrote:
Quoted 14 lines · Jan Beulich
Quoted 14 lines
Quoted 1 line
Quoted 1 line · On 20.02.18 at 12:01, <[email protected]> wrote:
xen/include/asm-x86/asm_defns.h +3
-0@@ -15,6 +15,9 @@#include <asm/alternative.h> #ifdef __ASSEMBLY__ +#ifndef CONFIG_INDIRECT_THUNK +.equ CONFIG_INDIRECT_THUNK, 0 +#endif # include <asm/indirect_thunk_asm.h> #else asm ( "\t.equ CONFIG_INDIRECT_THUNK, "Quoted 7 lines
Quoted 2 lines
It's fairly similar to my first approach, but at least "#ifdef
CONFIG_INDIRECT_THUNK" will still work as expected after this fix.I've used something similar in backports to old versions, so I wonder whether what you quote above is right: Assembly files don't get handed to clang anyway iirc, so the change would seem to be needed in the #else part of the conditional.
Assembly files do get handed to clang, from
xen/Rules.mk:%.o: %.S
Makefile$(CC) $(AFLAGS) -c $< -o $@
Quoted 7 lines
Quoted 2 lines
Xen doesn't call as directly to compile those, or am I missing something?
Oh, I was referring to the -mno-integrated-as (or whatever it's called) option. "Handed to clang" wasn't the best way to put it, I agree. But it's clang's integrated assembler which the problem is with.
Oh, I see. You are right, this is just a preparatory change for patch 4, which does enable clang's integrated assembler if the right features are present.
Let me know if you think the above chunk is acceptable.
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v4 3/4] x86: fix indirect thunk usage of CONFIG_INDIRECT_THUNK
Quoted 39 lines
Quoted 1 line
Quoted 1 line · On 20.02.18 at 13:42, <[email protected]> wrote:
Quoted 29 lines · Jan Beulich
Quoted 29 lines
Quoted 1 line
Quoted 1 line · On 20.02.18 at 12:22, <[email protected]> wrote:
Quoted 14 lines · Jan Beulich
Quoted 14 lines
Quoted 1 line
Quoted 1 line · On 20.02.18 at 12:01, <[email protected]> wrote:
xen/include/asm-x86/asm_defns.h +3
-0@@ -15,6 +15,9 @@#include <asm/alternative.h> #ifdef __ASSEMBLY__ +#ifndef CONFIG_INDIRECT_THUNK +.equ CONFIG_INDIRECT_THUNK, 0 +#endif # include <asm/indirect_thunk_asm.h> #else asm ( "\t.equ CONFIG_INDIRECT_THUNK, "Quoted 7 lines
Quoted 2 lines
It's fairly similar to my first approach, but at least "#ifdef
CONFIG_INDIRECT_THUNK" will still work as expected after this fix.I've used something similar in backports to old versions, so I wonder whether what you quote above is right: Assembly files don't get handed to clang anyway iirc, so the change would seem to be needed in the #else part of the conditional.
Assembly files do get handed to clang, from
xen/Rules.mk:%.o: %.S
Makefile$(CC) $(AFLAGS) -c $< -o $@Quoted 7 lines
Quoted 2 lines
Xen doesn't call as directly to compile those, or am I missing something?
Oh, I was referring to the -mno-integrated-as (or whatever it's called) option. "Handed to clang" wasn't the best way to put it, I agree. But it's clang's integrated assembler which the problem is with.
Quoted 5 lines
Oh, I see. You are right, this is just a preparatory change for patch 4, which does enable clang's integrated assembler if the right features are present.
Let me know if you think the above chunk is acceptable.
It is certainly acceptable if it helps; you now apparently agreeing I'm more confused though by this question. Iirc you don't enable the integrated assembler for assembly sources, but only for C ones.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v4 3/4] x86: fix indirect thunk usage of CONFIG_INDIRECT_THUNK
Quoted 43 lines · Jan Beulich
Quoted 43 lines
Quoted 1 line
Quoted 1 line · On 20.02.18 at 13:42, <[email protected]> wrote:
Quoted 29 lines · Jan Beulich
Quoted 29 lines
Quoted 1 line
Quoted 1 line · On 20.02.18 at 12:22, <[email protected]> wrote:
Quoted 14 lines · Jan Beulich
Quoted 14 lines
Quoted 1 line
Quoted 1 line · On 20.02.18 at 12:01, <[email protected]> wrote:
xen/include/asm-x86/asm_defns.h +3
-0@@ -15,6 +15,9 @@#include <asm/alternative.h> #ifdef __ASSEMBLY__ +#ifndef CONFIG_INDIRECT_THUNK +.equ CONFIG_INDIRECT_THUNK, 0 +#endif # include <asm/indirect_thunk_asm.h> #else asm ( "\t.equ CONFIG_INDIRECT_THUNK, "Quoted 7 lines
Quoted 2 lines
It's fairly similar to my first approach, but at least "#ifdef
CONFIG_INDIRECT_THUNK" will still work as expected after this fix.I've used something similar in backports to old versions, so I wonder whether what you quote above is right: Assembly files don't get handed to clang anyway iirc, so the change would seem to be needed in the #else part of the conditional.
Assembly files do get handed to clang, from
xen/Rules.mk:%.o: %.S
Makefile$(CC) $(AFLAGS) -c $< -o $@Quoted 7 lines
Quoted 2 lines
Xen doesn't call as directly to compile those, or am I missing something?
Oh, I was referring to the -mno-integrated-as (or whatever it's called) option. "Handed to clang" wasn't the best way to put it, I agree. But it's clang's integrated assembler which the problem is with.
Oh, I see. You are right, this is just a preparatory change for patch 4, which does enable clang's integrated assembler if the right features are present.
Quoted 5 lines
Quoted 1 line
Let me know if you think the above chunk is acceptable.
It is certainly acceptable if it helps; you now apparently agreeing I'm more confused though by this question. Iirc you don't enable the integrated assembler for assembly sources, but only for C ones.
So at this point the integrated assembler is only enabled for C sources.
In patch 4 I enable the integrated assembler for everything if possible, but in order to enable it I need to solve this issue first. I can merge patches 3 and 4 if it's going to be clearer.
Hope this help shed some light.
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v4 4/4 build/clang: add a check whether the assembler supports .skip with labels
In reply to Roger Pau MonneOr else switch off the integrated assembler. This is relevant for older clang versions which integrated assembler don't support .skip with labels.
---
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Tim Deegan <[email protected]>
Cc: Wei Liu <[email protected]>
--- xen/Rules.mk | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
xen/Rules.mk +5 -1
@@ -72,7 +72,11 @@ 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 -AFLAGS-$(clang) += -no-integrated-as +ifeq ($(clang),y) +ifeq ($(call as-insn,$(CC) $(AFLAGS),".L0:\n.L1:\n.skip (.L1 - .L0)",y,n),n) + AFLAGS += -no-integrated-as +endif +endif ALL_OBJS := $(ALL_OBJS-y)
Signature · 7 lines
2.16.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v4 4/4] build/clang: add a check whether the assembler supports .skip with labels
xen/Rules.mk AFLAGS-y += -D__ASSEMBLY__ · line 76
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 19.02.18 at 15:16, <[email protected]> wrote:
xen/Rules.mk +2
-1@@ -72,7 +72,11 @@ 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 -AFLAGS-$(clang) += -no-integrated-as +ifeq ($(clang),y) +ifeq ($(call as-insn,$(CC) $(AFLAGS),".L0:\n.L1:\n.skip (.L1 - .L0)",y,n),n)
Hmm, here you use AFLAGS, so why not as-insn-check?
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v4 4/4] build/clang: add a check whether the assembler supports .skip with labels
Quoted 5 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 19.02.18 at 15:16, <[email protected]> wrote:
xen/Rules.mk +0
-0@@ -72,7 +72,11 @@ AFLAGS-y += -D__ASSEMBLY__
Quoted 7 lines
xen/Rules.mk AFLAGS-y += -D__ASSEMBLY__ · line 76
Quoted 5 lines
xen/Rules.mk +2
-1# Older clang's built-in assembler doesn't understand .skip with labels: # https://bugs.llvm.org/show_bug.cgi?id=27369 -AFLAGS-$(clang) += -no-integrated-as +ifeq ($(clang),y) +ifeq ($(call as-insn,$(CC) $(AFLAGS),".L0:\n.L1:\n.skip (.L1 - .L0)",y,n),n)Hmm, here you use AFLAGS, so why not as-insn-check?
Because as-insn-check only lets you add to a variable on the success case (ie: when as-insn returns 'y'), and here I need to do the opposite.
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel