From: Richard Henderson <rth@twiddle.net>
To: li guang <lig.fnst@cn.fujitsu.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/2] tcg-arm: Implement tcg_register_jit
Date: Thu, 06 Jun 2013 05:48:43 -0700 [thread overview]
Message-ID: <51B0852B.9030306@twiddle.net> (raw)
In-Reply-To: <1370478487.17798.88.camel@liguang.fnst.cn.fujitsu.com>
On 06/05/2013 05:28 PM, li guang wrote:
> 在 2013-06-05三的 05:49 -0700,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?
>
> referred from gcc manual:
> "This attribute, attached to struct or union type definition, specifies
> that each member (other than zero-width bitfields) of the structure or
> union is placed to minimize the memory required."
>
> so, what I mean is as the manual said, this attribute mostly applies to
> struct or union.
>From the gcc manual:
@cindex @code{packed} attribute
The @code{packed} attribute specifies that a variable or structure field
should have the smallest possible alignment---one byte for a variable,
and one bit for a field, unless you specify a larger value with the
@code{aligned} attribute.
Notice "or structure field", which is exactly what I have above.
> forgive me if the question is fool,
> packed means seize minimal memory size, right?
It really means minimal alignment. Which means that no padding will be added
to ensure alignment. Which can lead to a reduction in memory size, but that's
not the major point.
r~
next prev parent reply other threads:[~2013-06-06 12:49 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
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 [this message]
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=51B0852B.9030306@twiddle.net \
--to=rth@twiddle.net \
--cc=lig.fnst@cn.fujitsu.com \
--cc=qemu-devel@nongnu.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.