[U-Boot] [PATCH v2] arm: Switch to -mno-unaligned-access when supported by the compiler

Tom Rini trini at ti.com
Mon Feb 10 17:24:03 CET 2014


On Mon, Feb 10, 2014 at 05:12:24PM +0100, Albert ARIBAUD wrote:
> Hi Måns,
> 
> On Mon, 10 Feb 2014 15:14:49 +0000, Måns Rullgård <mans at mansr.com>
> wrote:
> 
> > Albert ARIBAUD <albert.u.boot at aribaud.net> writes:
> > 
> > > Hi Tom,
> > >
> > > On Mon, 10 Feb 2014 08:21:39 -0500, Tom Rini <trini at ti.com> wrote:
> > >
> > >> On Mon, Feb 10, 2014 at 10:24:47AM +0100, Albert ARIBAUD wrote:
> > >> > Hi Tom,
> > >> > 
> > >> > On Tue,  4 Feb 2014 12:05:33 -0500, Tom Rini <trini at ti.com> wrote:
> > >> > 
> > >> > > When we tell the compiler to optimize for ARMv7 it assumes a default of
> > >> > > unaligned accesses being supported at the hardware level and can make
> > >> > > use of this to perform what it deems as an optimization in any case,
> > >> > > including allowing for data to become unaligned.  We explicitly disallow
> > >> > > this hardware feature so we must tell the compiler.
> > >> > > 
> > >> > > Cc: Albert ARIBAUD <albert.u.boot at aribaud.net>
> > >> > > Cc: Mans Rullgard <mans at mansr.com>
> > >> > > Signed-off-by: Tom Rini <trini at ti.com>
> > >> > 
> > >> > NAK -- the discrepancy between the compiler being told to allow native
> > >> > unaligned accesses while at the same time telling the hardware to trap
> > >> > them is conscious and voluntary. It was chosen to help detect unaligned
> > >> > accesses which are rarely necessary and can be explicitly performed by
> > >> > software on a case by case basis.
> > >> > 
> > >> > If and when a specific file requires unaligned access which cannot be
> > >> > made by some other mean than enabling -mno-unaligned-access, then this
> > >> > file should have it added, not the whole of U-Boot.
> > >> 
> > >> Right, I recall the discussion, and we chose wrong.
> > >
> > > I am quite prepared to discuss whether we chose wrong or right, and
> > > to change my mind when the conditions are right, but I'll need more than
> > > such a short and simple statement. :)
> > 
> > I already gave you a detailed explanation some months ago.  You refused
> > to read it.
> 
> I can hardly have "refused to read" a message which I *answered*, laid
> out how I thought the issue should be solved... and got no answer after
> this.
> 
> Now, are we going to discuss the technical issue or is this going to go
> debian-TC -- which I wouldn't see the point of.

Well, here's the point that I haven't seen an answer to.  If we tell the
compiler "you may choose to use unaligned accesses as an optimization,
we support this", the compiler says "OK, I shall do that", and then we
fail at run time because we don't actually allow the unaligned access,
how is this not a problem on our end for the first part of the equation,
keeping in mind that the real world is poorly designed and when we write
code to this reality the compiler does the correct thing in all cases
(or it's a compiler bug).

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140210/7637acb5/attachment.pgp>


More information about the U-Boot mailing list