From: =?iso-8859-1?Q?M=E5ns_Rullg=E5rd?= Date: Tue, 11 Feb 2014 16:44:46 +0000 Subject: [U-Boot] [PATCH v2] arm: Switch to -mno-unaligned-access when supported by the compiler In-Reply-To: <20140211173755.1ddfecfc@lilith> (Albert ARIBAUD's message of "Tue, 11 Feb 2014 17:37:55 +0100") References: <1391533533-21664-1-git-send-email-trini@ti.com> <20140210102447.03a4007f@lilith> <20140210132139.GT7049@bill-the-cat> <20140210155751.23849fcb@lilith> <20140210171224.477e2906@lilith> <20140210162403.GV7049@bill-the-cat> <20140210182646.2de92810@lilith> <20140210212630.GB7049@bill-the-cat> <20140210221723.B3DFB380603@gemini.denx.de> <20140210222819.GE7049@bill-the-cat> <20140211081909.BAAED380314@gemini.denx.de> <20140211144349.CBF9938032B@gemini.denx.de> <20140211173755.1ddfecfc@lilith> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Albert ARIBAUD writes: > Hi M?ns, > > On Tue, 11 Feb 2014 15:33:09 +0000, M?ns Rullg?rd > wrote: > >> The problem is that the current settings do >> the exact opposite. By using -munaligned-access by default, you are >> asking the compiler to go ahead and do whatever it thinks is best, which >> is sometimes to perform an intentional unaligned access. Exactly when >> this will happen is largely impossible to predict. > > The -munaligned-access option does *not* "[ask] the compiler to go > ahead and do whatever it thinks is best", it tells it to use direct > native accesses when unaligned accesses are required, as opposed to > splitting unaligned accesses into smaller but aligned aligned native > accesses, which is what you get with -mno-unaligned-access. The flag does both of those things. It even gives the compiler permission to merge multiple adjacent accesses into a single wider one. >> To get the behaviour you desire, the code should be compiled with >> -mno-unaligned-access. This tells the compiler to _never_ automatically >> perform an unaligned memory access. If it thinks an address might be >> unaligned, it will split the access. > > This shows that you really have not read my argument, in which I *did* > explain why we tell the compiler *not* to split unaligned accesses into > smaller correctly aligned accesses, i.e., why -munaligned-access is > used. I have read what you call your argument. Unfortunately for you, it is based on false premises, and as such any conclusions you arrive at are incorrect. -- M?ns Rullg?rd mans at mansr.com