From: Jiri Slaby <jslaby@suse.cz>
To: Russell King <rmk@arm.linux.org.uk>
Cc: Arnd Bergmann <arnd@arndb.de>,
Arend van Spriel <arend@broadcom.com>,
linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
devel@linuxdriverproject.org, gregkh@suse.de,
linux-wireless@vger.kernel.org, Jiri Slaby <jirislaby@gmail.com>
Subject: Re: [PATCH 1/1] drivers: brcmaxi: provide amba axi functionality in separate module
Date: Thu, 31 Mar 2011 18:10:41 +0200 [thread overview]
Message-ID: <4D94A781.6060904@suse.cz> (raw)
In-Reply-To: <20110331141424.GD19540@flint.arm.linux.org.uk>
On 03/31/2011 04:14 PM, Russell King wrote:
> On Thu, Mar 31, 2011 at 04:09:32PM +0200, Jiri Slaby wrote:
>> On 03/31/2011 03:51 PM, Russell King wrote:
>>> On Thu, Mar 31, 2011 at 03:48:20PM +0200, Jiri Slaby wrote:
>>>> How it can? Packed only tells the compiler to have one byte alignment
>>>> steps. And it should not matter here as all the members are 32-bit long.
>>>
>>> It also tells the compiler that it may be misaligned, so to avoid
>>> alignment faults it will use byte loads/stores.
>>
>> No, it should not (if offsetof % sizeof == 0). Otherwise it's a bug in
>> the compiler.
>>
>> Am I missing something?
>
> $ cat t1.c
> struct foo {
> unsigned long bar;
> } __attribute__((packed));
>
> unsigned long baz(struct foo *f)
> {
> return f->bar;
> }
> $ arm-linux-gcc -O2 -S -o - t1.c
> ...
> .global baz
> .type baz, %function
> baz:
> @ args = 0, pretend = 0, frame = 0
> @ frame_needed = 0, uses_anonymous_args = 0
> @ link register save eliminated.
> ldrb r3, [r0, #0] @ zero_extendqisi2
> ldrb r2, [r0, #1] @ zero_extendqisi2
> ldrb r1, [r0, #2] @ zero_extendqisi2
> orr r3, r3, r2, asl #8
> ldrb r0, [r0, #3] @ zero_extendqisi2
> orr r3, r3, r1, asl #16
> orr r0, r3, r0, asl #24
> mov pc, lr
> .size baz, .-baz
> .ident "GCC: (GNU) 4.3.5"
> .section .note.GNU-stack,"",%progbits
>
> It does this because with the packed attribute, it can't make assumptions
> about the alignment of 'f'.
I don't see why it couldn't like without the packed attribute. (The
manual says packed attribute for a struct is equivalent to specifying
packed to each member of that struct. It doesn't say anything about the
structure alignment itself.)
Ok, not that I'm fully convinced, but it doesn't matter.
So let's NOT mark it packed.
Anyway the info you sent was useful for me.
thanks,
--
js
suse labs
next prev parent reply other threads:[~2011-03-31 16:10 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-29 9:40 [PATCH 0/1] new module for amba axi on-chip interconnect Arend van Spriel
2011-03-29 9:40 ` [PATCH 1/1] drivers: brcmaxi: provide amba axi functionality in separate module Arend van Spriel
2011-03-29 10:45 ` Jiri Slaby
2011-03-30 12:53 ` Arnd Bergmann
2011-03-31 13:48 ` Jiri Slaby
2011-03-31 13:51 ` Russell King
2011-03-31 14:09 ` Jiri Slaby
2011-03-31 14:14 ` Russell King
2011-03-31 16:10 ` Jiri Slaby [this message]
2011-04-01 9:14 ` Arnd Bergmann
2011-03-29 13:14 ` [PATCH 0/1] new module for amba axi on-chip interconnect Greg KH
2011-03-29 18:19 ` Russell King
2011-03-30 13:09 ` Arnd Bergmann
2011-03-30 17:40 ` Russell King - ARM Linux
2011-03-30 18:24 ` Arnd Bergmann
2011-03-30 19:08 ` Russell King - ARM Linux
2011-04-01 15:40 ` Arnd Bergmann
2011-03-29 18:30 ` Christoph Hellwig
2011-03-29 18:40 ` Russell King
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=4D94A781.6060904@suse.cz \
--to=jslaby@suse.cz \
--cc=akpm@linux-foundation.org \
--cc=arend@broadcom.com \
--cc=arnd@arndb.de \
--cc=devel@linuxdriverproject.org \
--cc=gregkh@suse.de \
--cc=jirislaby@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=rmk@arm.linux.org.uk \
/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).