From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42670) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UkDM2-0001qM-Dn for qemu-devel@nongnu.org; Wed, 05 Jun 2013 09:02:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UkDM0-0002e7-Ub for qemu-devel@nongnu.org; Wed, 05 Jun 2013 09:02:18 -0400 Received: from cantor2.suse.de ([195.135.220.15]:33340 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UkDM0-0002dw-NQ for qemu-devel@nongnu.org; Wed, 05 Jun 2013 09:02:16 -0400 Message-ID: <51AF36D5.3030702@suse.de> Date: Wed, 05 Jun 2013 15:02:13 +0200 From: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= MIME-Version: 1.0 References: <1369430452-27598-1-git-send-email-rth@twiddle.net> <1370397380.17798.73.camel@liguang.fnst.cn.fujitsu.com> <51AF33E8.4010704@twiddle.net> In-Reply-To: <51AF33E8.4010704@twiddle.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 1/2] tcg-arm: Implement tcg_register_jit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: qemu-devel@nongnu.org, li guang Am 05.06.2013 14:49, schrieb Richard Henderson: > On 06/04/2013 06:56 PM, li guang wrote: >>>> +typedef struct { >>>> + uint32_t len __attribute__((aligned((sizeof(void *))))); >>>> + uint32_t cie_offset; >>>> + tcg_target_long func_start __attribute__((packed)); >>>> + tcg_target_long func_len __attribute__((packed)); >> suspicious usage of packed attribute here, >> since tcg_targe_long is either 32 or 64 bits, >> not a struct or union. >> >> Thanks! >> >=20 > Your question is worded poorly -- what has struct/union got to do with = it? One > can adjust the alignment of any type. Perhaps you don't know what it i= s that > __attribute__((packed)) actually does? To me the English word "packed" refers to a struct containing no alignment padding, i.e. sizeof(the struct) =3D sum(sizeof(each field)). The use of __attribute__((packed)) on an individual field while quite possibly valid is unusual and I believe we have a QEMU_PACKED macro. So why can't you apply QEMU_PACKED to the whole struct? Because of the contradicting void* alignment attribute of the first field? Cheers, Andreas > While it's true that for ARM all four of these data members are 32-bit,= and > thus none of the attributes are required, it's not actually wrong. Giv= en that > this sort of boiler-plate tends to get copied from target to target, an= d since > the attributes *are* required for 64-bit hosts, I prefer to keep all su= ch > structures defined similarly. >=20 >=20 > r~ --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=C3=B6rffer; HRB 16746 AG N=C3=BC= rnberg