From: Robert Jarzmik <robert.jarzmik@free.fr>
To: Stephen Warren <swarren@wwwdotorg.org>, Andrew Lunn <andrew@lunn.ch>
Cc: swarren@nvidia.com, linux-kernel@vger.kernel.org,
haojian.zhuang@gmail.com, linux-arm-kernel@lists.infradead.org,
jic23@cam.ac.uk, kay@vrfy.org
Subject: Re: Follow-up to remaining issue with alignment of __log_buf in printk.c
Date: Fri, 15 Jun 2012 00:22:43 +0200 [thread overview]
Message-ID: <87y5np1qks.fsf@free.fr> (raw)
In-Reply-To: 4FDA3BB4.9040607@wwwdotorg.org
Stephen Warren <swarren@wwwdotorg.org> writes:
> Isn't that a bug in the toolchain; isn't the alignment of a struct
> required to be the greatest alignment of any of its members? Otherwise,
> this problem could arise with any usage of that struct.
I'm not a compiler expert, but I think EABI requires 64-bit data types to be
8-bytes aligned. If that assertion is true, then clearly my eabi compiler is a
little liar with its __alignof__(struct log) result.
And I think also that ISO C standard requires a structure to be aligned by
default to the <quote>least perfect multiple of the lowest common multiple of
the alignments of all the members of the struct</quote>. Which here means 8
bytes ...
> I suppose this could be worked around with something like:
> #define LOG_ALIGN max(__alignof__(struct log), __alignof__(u64))
Well, I wonder what is the correct approach here. In the end, the compiler
should be fixed ... But meanwhile, your proposition would solve the PXA
problem. The real deal is to know whether we want a compiler work-around in
printk.c ... and that's rather a policy issue than a technical one.
I wonder what others think about it ... let's wait for another pair of point of
views.
Cheers.
--
Robert
PS: For Andrew, I saw your patch. It won't solve my problem as my compiler
believes __alignof__(struct log) == 4 ... bad luck for me.
PPS: My toolchain is arm-2011.09
next prev parent reply other threads:[~2012-06-14 22:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-14 19:19 Follow-up to remaining issue with alignment of __log_buf in printk.c Robert Jarzmik
2012-06-14 19:29 ` Stephen Warren
2012-06-14 22:22 ` Robert Jarzmik [this message]
2012-06-15 0:27 ` Andrew Lunn
-- strict thread matches above, loose matches on Subject: below --
2012-06-14 19:49 Andrew Lunn
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=87y5np1qks.fsf@free.fr \
--to=robert.jarzmik@free.fr \
--cc=andrew@lunn.ch \
--cc=haojian.zhuang@gmail.com \
--cc=jic23@cam.ac.uk \
--cc=kay@vrfy.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=swarren@nvidia.com \
--cc=swarren@wwwdotorg.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox