[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] x86/compat: fix compilation errors with clang 6



On Tue, Jan 23, 2018 at 06:34:44AM -0700, Jan Beulich wrote:
> >>> On 23.01.18 at 13:38, <roger.pau@xxxxxxxxxx> wrote:
> > Fix this by using pragma push/pop in order to store the current pragma
> > value in the compiler stack and later restoring it.
> 
> For Linux this is fine all the way back to gcc 4.1 afaict, but what
> about other OSes using gcc? In 4.1, only config/linux.h and a few
> special config/i386/*.h define the necessary macro
> (HANDLE_PRAGMA_PACK_PUSH_POP).

OK, then I have the following version:

diff --git a/xen/include/Makefile b/xen/include/Makefile
index 1299b1962f..19066a33a0 100644
--- a/xen/include/Makefile
+++ b/xen/include/Makefile
@@ -35,8 +35,13 @@ cppflags-y                := -include public/xen-compat.h 
-DXEN_GENERATING_COMPA
 cppflags-$(CONFIG_X86)    += -m32
 
 # 8-byte types are 4-byte aligned on x86_32 ...
+ifeq ($(clang),y)
+prefix-$(CONFIG_X86)      := \#pragma pack(push, 4)
+suffix-$(CONFIG_X86)      := \#pragma pack(pop)
+else
 prefix-$(CONFIG_X86)      := \#pragma pack(4)
 suffix-$(CONFIG_X86)      := \#pragma pack()
+endif
 
 endif
 

Since ATM that's a clang only issue I guess we can leave it like that.
I'm not aware of anyway to know whether the compiler supports pragma
pack with psuh/pop.

Let me know if that's fine and I will send out a formal v2.

Roger.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.