From patchwork Tue Oct 9 18:34:11 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Rini X-Patchwork-Id: 190403 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id C48BA2C00A3 for ; Wed, 10 Oct 2012 05:36:05 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9476A28071; Tue, 9 Oct 2012 20:36:02 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LU+4wW6LJzng; Tue, 9 Oct 2012 20:36:00 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E9C5028077; Tue, 9 Oct 2012 20:35:35 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D15762808D for ; Tue, 9 Oct 2012 20:35:01 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jQsfPl0Gz7OG for ; Tue, 9 Oct 2012 20:34:29 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-pb0-f44.google.com (mail-pb0-f44.google.com [209.85.160.44]) by theia.denx.de (Postfix) with ESMTPS id 1A50728077 for ; Tue, 9 Oct 2012 20:34:12 +0200 (CEST) Received: by mail-pb0-f44.google.com with SMTP id ro8so5701683pbb.3 for ; Tue, 09 Oct 2012 11:34:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:organization :user-agent; bh=BXt3V8LxfpMO662Wa2pDBvHVpoNb8+Ktt8hg0SUv7ZQ=; b=rPAUeB8DVKN9MPYZv2gpkicWws+pg9d850IpeTK5Fqk1b3uANOUeLPWOA78SessnPS UwMyNAh7ZcT9b9hVxvo9QftZ5AEp0R/MtepE4fVbbqcaCOpBUo3j5iAwc13eUYQyNBgu 93rCEnNJX4rawqP08YmXi0Xa2EapnshJJ/s5bEvTsgHQyXd/bvkio9wNJ2ZuM0M8QbXg wKaB68ncpqD2jq9+NzNgv5wi8GiK93Bc5b2qFU55N71Oisdu7rhZr2mOFjmEtF0/LrQU ns/DvpieUBnJu7lfcaE45KP3ww5lccfVs77rMEQC76C7vB63UghO0HSzqE3nJXhh4sFP P+Cw== Received: by 10.68.129.233 with SMTP id nz9mr66104919pbb.136.1349807646279; Tue, 09 Oct 2012 11:34:06 -0700 (PDT) Received: from bill-the-cat ([2001:470:d:eba:d921:cb9:5b45:279c]) by mx.google.com with ESMTPS id pw2sm11103197pbb.59.2012.10.09.11.34.03 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 09 Oct 2012 11:34:05 -0700 (PDT) Date: Tue, 9 Oct 2012 11:34:11 -0700 From: Tom Rini To: Albert ARIBAUD Message-ID: <20121009183411.GB1137@bill-the-cat> References: <1349723944-8188-1-git-send-email-albert.u.boot@aribaud.net> <1349464558-7311-1-git-send-email-albert.u.boot@aribaud.net> <1349725818-8500-1-git-send-email-albert.u.boot@aribaud.net> MIME-Version: 1.0 In-Reply-To: <1349725818-8500-1-git-send-email-albert.u.boot@aribaud.net> Organization: Texas Instruments User-Agent: Mutt/1.5.21 (2010-09-15) Cc: u-boot@lists.denx.de Subject: Re: [U-Boot] [PATCH V4] ARM: prevent misaligned array inits X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de On Mon, Oct 08, 2012 at 09:50:18PM +0200, Albert ARIBAUD wrote: > Under option -munaligned-access, gcc can perform local char > or 16-bit array initializations using misaligned native > accesses which will throw a data abort exception. Fix files > where these array initializations were unneeded, and for > files known to contain such initializations, enforce gcc > option -mno-unaligned-access. > > Signed-off-by: Albert ARIBAUD We unfortunately have a problem here. This ends up passing -mno-unaligned-access globally, for all platforms. We need something like the following: Ensure that we only pass -mno-unaligned-access to ARMv7 platforms (where we must ensure this flag is passed so no using call-cc-option). Signed-off-by; Tom Rini diff --git a/arch/arm/cpu/armv7/config.mk b/arch/arm/cpu/armv7/config.mk index 5407cb6..3c5ca23 100644 --- a/arch/arm/cpu/armv7/config.mk +++ b/arch/arm/cpu/armv7/config.mk @@ -34,6 +34,10 @@ PLATFORM_CPPFLAGS += $(PF_CPPFLAGS_ARMV7) # ========================================================================= PF_RELFLAGS_SLB_AT := $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) PLATFORM_RELFLAGS += $(PF_RELFLAGS_SLB_AT) + +# SEE README.arm-unaligned-accesses +PLATFORM_NO_UNALIGNED := -mno-unaligned-access + ifneq ($(CONFIG_IMX_CONFIG),) ALL-y += $(obj)u-boot.imx endif diff --git a/common/Makefile b/common/Makefile index a498367..33c606a 100644 --- a/common/Makefile +++ b/common/Makefile @@ -233,8 +233,8 @@ $(obj)../tools/envcrc: $(MAKE) -C ../tools # SEE README.arm-unaligned-accesses -$(obj)hush.o: CFLAGS += -mno-unaligned-access -$(obj)fdt_support.o: CFLAGS += -mno-unaligned-access +$(obj)hush.o: CFLAGS += $(PLATFORM_NO_UNALIGNED) +$(obj)fdt_support.o: CFLAGS += $(PLATFORM_NO_UNALIGNED) ######################################################################### diff --git a/fs/fat/Makefile b/fs/fat/Makefile index 5c4a2aa..02e6881 100644 --- a/fs/fat/Makefile +++ b/fs/fat/Makefile @@ -40,7 +40,7 @@ $(LIB): $(obj).depend $(OBJS) $(call cmd_link_o_target, $(OBJS)) # SEE README.arm-unaligned-accesses -$(obj)file.o: CFLAGS += -mno-unaligned-access +$(obj)file.o: CFLAGS += $(PLATFORM_NO_UNALIGNED) ######################################################################### diff --git a/fs/ubifs/Makefile b/fs/ubifs/Makefile index 71c40f2..bfe6874 100644 --- a/fs/ubifs/Makefile +++ b/fs/ubifs/Makefile @@ -43,7 +43,7 @@ $(LIB): $(obj).depend $(OBJS) $(call cmd_link_o_target, $(OBJS)) # SEE README.arm-unaligned-accesses -$(obj)super.o: CFLAGS += -mno-unaligned-access +$(obj)super.o: CFLAGS += $(PLATFORM_NO_UNALIGNED) ######################################################################### diff --git a/lib/Makefile b/lib/Makefile index decc5ee..e44e045 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -84,7 +84,7 @@ $(LIB): $(obj).depend $(OBJS) $(call cmd_link_o_target, $(OBJS)) # SEE README.arm-unaligned-accesses -$(obj)bzlib.o: CFLAGS += -mno-unaligned-access +$(obj)bzlib.o: CFLAGS += $(PLATFORM_NO_UNALIGNED) #########################################################################