From: "Andreas Färber" <afaerber@suse.de>
To: Richard Henderson <rth@twiddle.net>
Cc: qemu-devel@nongnu.org, li guang <lig.fnst@cn.fujitsu.com>
Subject: Re: [Qemu-devel] [PATCH 1/2] tcg-arm: Implement tcg_register_jit
Date: Wed, 05 Jun 2013 15:02:13 +0200 [thread overview]
Message-ID: <51AF36D5.3030702@suse.de> (raw)
In-Reply-To: <51AF33E8.4010704@twiddle.net>
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!
>>
>
> 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 is that
> __attribute__((packed)) actually does?
To me the English word "packed" refers to a struct containing no
alignment padding, i.e. sizeof(the struct) = 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. Given that
> this sort of boiler-plate tends to get copied from target to target, and since
> the attributes *are* required for 64-bit hosts, I prefer to keep all such
> structures defined similarly.
>
>
> r~
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
next prev parent reply other threads:[~2013-06-05 13:02 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-24 21:20 [Qemu-devel] [PATCH 1/2] tcg-arm: Implement tcg_register_jit Richard Henderson
2013-05-24 21:20 ` [Qemu-devel] [PATCH 2/2] tcg: Fix high_pc fields in .debug_info Richard Henderson
2013-06-04 20:03 ` [Qemu-devel] [PATCH 1/2] tcg-arm: Implement tcg_register_jit Richard Henderson
2013-06-05 1:56 ` li guang
2013-06-05 12:49 ` Richard Henderson
2013-06-05 13:02 ` Andreas Färber [this message]
2013-06-05 13:04 ` Richard Henderson
2013-06-05 13:10 ` Peter Maydell
2013-06-05 13:17 ` Richard Henderson
2013-06-06 0:28 ` li guang
2013-06-06 12:48 ` Richard Henderson
2013-06-10 0:56 ` li guang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51AF36D5.3030702@suse.de \
--to=afaerber@suse.de \
--cc=lig.fnst@cn.fujitsu.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).