[U-Boot] [PATCH v2] arm: Switch to -mno-unaligned-access when supported by the compiler
Wolfgang Denk
wd at denx.de
Mon Feb 10 19:54:22 CET 2014
Dear Albert,
In message <20140210182646.2de92810 at lilith> you wrote:
...
> - first, if "the first part of the equation" means "the compiler
> setting" as opposed to the hardware setting, then the question
> fails to realize that we don't (and should not) consider the
> compiler and hardware settings separately; they work in
> *combination*.
Right, and we have full control over both sides of this combination:
we set the compiler options in the Makefiles, and adjust the hardware
selections in the code.
> - second, assuming the question is "how is it not a problem on our
> end that some code traps due to the combined hardware and compiler
> settings", the answer is: because the setting was not designed to
> catch *ARMv7* issues; it was designed to catch *U-Boot* issues. In
> other words, such traps show that there is code which won't work
> elsewhere than on ARMv7-like hardware which does not care about
> alignment.
Full agreement. It is wrong to write code with only the feature set
off a specific architecture in mind.
> That is why I consider that the fault is in the trapped software, not
> in the trap. The solution is to make the software use software, not
> native, unaligned accesses. The exact solution depends on whether the
> code has only a few such unaligned accesses (in which case we should
> use explicit unaligned access macros) or many (in which case, for the
> file considered, we can enable -mno-unaligned-access). You'll find
> instances of both in the U-Boot code.
I agree mostly here - except that I tend to be even more radical: if
we need to enable -mno-unaligned-access, then the code is inherently
non-portable and should rather be redesigned / rewritten.
> - I am ok with -mno-unaligned-access applied to files which *require*
> unaligned access and where individual access macros would be
> impractical.
I can live with this if we raise the bar sufficiently high so that
only very few exceptions will be made. I would not like to see this
enabled on tons of files.
> - I am NOT OK with blanket -mno-unaligned-access applied on a file
> where individual macros are feasible, and
Full agreement. But even in this case we should first consider if the
code can / should not rather be rewitten to avoid the problem
alltogether.
> - I am certainly NOT OK with a blanket -mno-unaligned-access on all
> code and the removal of the whole ARM misalignment detection setup.
I agree with Albert here.
Thanks for the detailed explanation, bte.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The following statement is not true. The previous statement is true.
More information about the U-Boot
mailing list