x86/hyperv: change hv_tlb_flush_ex to fix clang build
PATCH 1/1 x86/hyperv: change hv_tlb_flush_ex to fix clang build
Clang complains:
In file included from synic.c:15:
/builds/xen-project/xen/xen/include/asm/guest/hyperv-tlfs.h:900:18: error: field 'hv_vp_set' with variable sized type 'struct hv_vpset' not at the end of a struct or class is a GNU extension [-Werror,-Wgnu-variable-sized-type-not-at-end]
struct hv_vpset hv_vp_set;
^1 error generated.
/builds/xen-project/xen/xen/Rules.mk:198: recipe for target 'synic.o' failed make[6]: *** [synic.o] Error 1
Drop the last variable size array from hv_tlb_flush_ex for now to fix clang builds.
--- xen/include/asm-x86/guest/hyperv-tlfs.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
xen/include/asm-x86/guest/hyperv-tlfs.h +1 -2
@@ -893,12 +893,11 @@ struct hv_tlb_flush {u64 gva_list[]; } __packed; -/* HvFlushVirtualAddressSpaceEx, HvFlushVirtualAddressListEx hypercalls */ +/* HvFlushVirtualAddressSpaceEx hypercall */ struct hv_tlb_flush_ex {u64 address_space;u64 flags;struct hv_vpset hv_vp_set; -u64 gva_list[]; } __packed;struct hv_partition_assist_pg {
Signature · 7 lines
2.20.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 6 lines · Wei Liu
Clang complains:
In file included from synic.c:15:
/builds/xen-project/xen/xen/include/asm/guest/hyperv-tlfs.h:900:18: error: field 'hv_vp_set' with variable sized type 'structhv_vpset' not at the end of a struct or class is a GNU extension [-Werror,-Wgnu-variable-sized-type-not-at-end]struct hv_vpset hv_vp_set; ^
I'm surprised gcc does not complain.
Quoted 6 lines
1 error generated.
/builds/xen-project/xen/xen/Rules.mk:198: recipe for target 'synic.o' failed make[6]: *** [synic.o] Error 1Drop the last variable size array from
hv_tlb_flush_exfor now to fix clang builds.
Why "for now"? The field is illegal there, and I can't see a way to make it legal. To know its actual place in memory you need to know the number of elements in bank_contents[], i.e. having the field if the compiler erroneously accepted it would mean wrong code to get generated (silently).
xen/include/asm-x86/guest/hyperv-tlfs.h struct hv_tlb_flush { · line 901
Quoted 13 lines
xen/include/asm-x86/guest/hyperv-tlfs.h +1
-2@@ -893,12 +893,11 @@ struct hv_tlb_flush {u64 gva_list[]; } __packed; -/* HvFlushVirtualAddressSpaceEx, HvFlushVirtualAddressListEx hypercalls */ +/* HvFlushVirtualAddressSpaceEx hypercall */ struct hv_tlb_flush_ex {u64 address_space;u64 flags;struct hv_vpset hv_vp_set; -u64 gva_list[];
Rather than outright removing the line, keep it as a comment?
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 9 lines · Jan Beulich
Quoted 6 lines · Wei Liu
Clang complains:
In file included from synic.c:15:
/builds/xen-project/xen/xen/include/asm/guest/hyperv-tlfs.h:900:18: error: field 'hv_vp_set' with variable sized type 'structhv_vpset' not at the end of a struct or class is a GNU extension [-Werror,-Wgnu-variable-sized-type-not-at-end]struct hv_vpset hv_vp_set; ^I'm surprised gcc does not complain.
Me too.
Quoted 5 lines
Quoted 5 lines
1 error generated.
/builds/xen-project/xen/xen/Rules.mk:198: recipe for target 'synic.o' failed make[6]: *** [synic.o] Error 1
Quoted 9 lines
Quoted 2 lines
Drop the last variable size array from
hv_tlb_flush_exfor now to fix clang builds.Why "for now"? The field is illegal there, and I can't see a way to make it legal. To know its actual place in memory you need to know the number of elements in bank_contents[], i.e. having the field if the compiler erroneously accepted it would mean wrong code to get generated (silently).
OK. I can drop "for now".
Quoted 6 lines
Quoted 6 lines
xen/include/asm-x86/guest/hyperv-tlfs.h +0
-0@@ -893,12 +893,11 @@ struct hv_tlb_flush {u64 gva_list[]; } __packed;
Quoted 9 lines
xen/include/asm-x86/guest/hyperv-tlfs.h struct hv_tlb_flush { · line 901
Quoted 7 lines
xen/include/asm-x86/guest/hyperv-tlfs.h +1
-2-/* HvFlushVirtualAddressSpaceEx, HvFlushVirtualAddressListEx hypercalls */ +/* HvFlushVirtualAddressSpaceEx hypercall */ struct hv_tlb_flush_ex {u64 address_space;u64 flags;struct hv_vpset hv_vp_set; -u64 gva_list[];Rather than outright removing the line, keep it as a comment?
That's fine by me.
Wei.
Quoted 2 lines
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel