From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Warren Date: Mon, 27 May 2013 22:07:46 -0600 Subject: [U-Boot] [PATCH] input: fix unaligned access in key_matrix_decode_fdt() In-Reply-To: References: <1369248498-1799-1-git-send-email-swarren@wwwdotorg.org> Message-ID: <51A42D92.60205@wwwdotorg.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 05/26/2013 01:28 PM, Simon Glass wrote: > > On Wed, May 22, 2013 at 11:48 AM, Stephen Warren > wrote: > > From: Stephen Warren > > > Initialized character arrays on the stack can cause gcc to emit code > that > performs unaligned accessess. Make the data static to avoid this. > > Note that the unaligned accesses are made when copying data to > prefix[] on > the stack from .rodata. By making the data static, the copy is > completely > avoided. All explicitly written code treats the data as u8[], so > will never > cause any unaligned accesses. > > Signed-off-by: Stephen Warren > > > > Acked-by: Simon Glass > > > Thanks for fixing. > > I hit this with gcc 4.7. I wonder if previous revisions would not make > this assumption? IIRC, gcc-4.7 introduces the emission of native unaligned accesses, and it's been back-ported to Linaro gcc-4.6. > Another problem I have is that the 'linux' in 'linux,keymap' in the > device compile turns into '1' since gcc predefines 'linux' to 1: > > I think I'm going to add a -Ulinux to dts/Makefile. I forget the exact details, but if you check the Linux makefiles for dtc+cpp, they don't suffer from this issue any more; it may have been due to use of -x assembler-with-cpp. I do also have a bug filed internally to NVIDIA to fix that, which is assigned to Tom. But, I'm sure he'd be glad if you fixed it:-)