From: John Levon Subject: Re: [PATCH] Partial fix for compat build non-portability Date: Thu, 11 Jan 2007 16:29:59 +0000 Message-ID: <20070111162959.GA25963@totally.trollied.org.uk> References: <20070110173719.GA31121@totally.trollied.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org On Wed, Jan 10, 2007 at 06:21:05PM +0000, Keir Fraser wrote: > We only care about it working for the x86/64 target since that's the only > one that asserts CONFIG_COMPAT. Why would wrapping structs individually be > better than wrapping whole header files? I've been building with the below, but haven't verified it's correct. regards john # HG changeset patch # User john.levon@sun.com # Date 1168532284 28800 # Node ID 30f9b54e54d444fa1f897257b6a35d8caabc8b6e # Parent cf35b1e695d68c4503784506ee62ceffcff69452 Enforce pragma pack(4) for the compat headers. Signed-off-by: John Levon diff --git a/xen/include/Makefile b/xen/include/Makefile --- a/xen/include/Makefile +++ b/xen/include/Makefile @@ -32,8 +32,8 @@ cppflags-$(CONFIG_X86) += -m32 cppflags-$(CONFIG_X86) += -m32 # 8-byte types are 4-byte aligned on x86_32 ... -prefix-$(CONFIG_X86) := \#pragma pack(push, 4) -suffix-$(CONFIG_X86) := \#pragma pack(pop) +prefix-$(CONFIG_X86) := \#pragma pack(4) +suffix-$(CONFIG_X86) := \#pragma pack() endif diff --git a/xen/tools/compat-build-header.py b/xen/tools/compat-build-header.py --- a/xen/tools/compat-build-header.py +++ b/xen/tools/compat-build-header.py @@ -3,7 +3,7 @@ import re,sys import re,sys pats = [ - [ r"__InClUdE__", r"#include" ], + [ r"__InClUdE__(.*)", r"#include\1\n#pragma pack(4)" ], [ r"\"xen-compat.h\"", r"" ], [ r"(struct|union|enum)\s+(xen_?)?(\w)", r"\1 compat_\3" ], [ r"@KeeP@", r"" ],