From: "Jan Beulich" Subject: uint64_aligned_t not compatible across gcc versions Date: Mon, 28 Aug 2006 15:46:26 +0100 Message-ID: <44F31DE2.76E4.0078.0@novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org gcc up to 3.3.x doesn't honor __attribute__((__aligned(..))) on typedef-s (and in my opinion this was the correct behavior, as a typedef and its original type must be fully exchangeable in all their uses). For this reason, I'd recommend changing the definition of this type on x86_32 with below patch. Further looking into how it is being used and therefore into the uses of XEN_GUEST_HANDLE_64 I am not really clear about the intentions of that macro and its companions: Reserving a 64-bit slot for a pointer would seem nice for doing the compatibility layer, but turns out useless if the 32-bit native implementation doesn't check the upper half of passed in values, as that implies that the 64-bit compatibility layer must not assume these upper bits are all zero or else it wouldn't be binary compatible. Jan Signed-off-by: Jan Beulich Index: 2006-08-28/xen/include/public/arch-x86_32.h =================================================================== --- 2006-08-28.orig/xen/include/public/arch-x86_32.h 2006-08-28 08:32:38.000000000 +0200 +++ 2006-08-28/xen/include/public/arch-x86_32.h 2006-08-28 16:35:11.000000000 +0200 @@ -29,12 +29,14 @@ /* Structural guest handles introduced in 0x00030201. */ #if (defined(__XEN__) || defined(__XEN_TOOLS__)) && !defined(__ASSEMBLY__) -typedef uint64_t __attribute__((aligned(8))) uint64_aligned_t; +#define uint64_aligned_t uint64_t __attribute__((__aligned__(8))) #define __DEFINE_XEN_GUEST_HANDLE(name, type) \ typedef struct { type *p; } \ __guest_handle_ ## name; \ - typedef struct { union { type *p; uint64_aligned_t q; }; } \ - __guest_handle_64_ ## name + typedef union { \ + type *p; \ + uint64_t __attribute__((__aligned__(8))) q; \ + } __guest_handle_64_ ## name #elif __XEN_INTERFACE_VERSION__ >= 0x00030201 #define __DEFINE_XEN_GUEST_HANDLE(name, type) \ typedef struct { type *p; } __guest_handle_ ## name