From patchwork Sat Aug 24 11:55:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeroen Hofstee X-Patchwork-Id: 269634 X-Patchwork-Delegate: albert.aribaud@free.fr 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 D4F802C0097 for ; Sat, 24 Aug 2013 21:56:11 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 03ED44A094; Sat, 24 Aug 2013 13:56:10 +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 M962AR8C7zn0; Sat, 24 Aug 2013 13:56:09 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 928D54A081; Sat, 24 Aug 2013 13:56:04 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 952254A081 for ; Sat, 24 Aug 2013 13:56: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 q1o+5T8TmFR4 for ; Sat, 24 Aug 2013 13:55:56 +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 smtp8.versatel.nl (smtp8.versatel.nl [62.58.50.100]) by theia.denx.de (Postfix) with ESMTPS id 215444A080 for ; Sat, 24 Aug 2013 13:55:50 +0200 (CEST) Received: (qmail 12653 invoked by uid 0); 24 Aug 2013 11:55:50 -0000 Received: from ip120-12-208-87.adsl2.static.versatel.nl (HELO router.myspectrum.nl) ([87.208.12.120]) (envelope-sender ) by smtp8.versatel.nl (qmail-ldap-1.03) with SMTP for < >; 24 Aug 2013 11:55:50 -0000 Received: from black (unknown [10.0.0.107]) by router.myspectrum.nl (Postfix) with ESMTP id 22D0C1BE2A; Sat, 24 Aug 2013 13:55:50 +0200 (CEST) Received: by black (Postfix, from userid 1000) id C076C1D80C2E; Sat, 24 Aug 2013 13:55:49 +0200 (CEST) From: Jeroen Hofstee To: u-boot@lists.denx.de Date: Sat, 24 Aug 2013 13:55:38 +0200 Message-Id: <1377345338-9695-1-git-send-email-jeroen@myspectrum.nl> X-Mailer: git-send-email 1.8.1.2 Cc: Jeroen Hofstee , TigerLiu@viatech.com.cn Subject: [U-Boot] [PATCH] arm: prevent using movt/movw address loads 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: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de The movt/movw instruction can be used to hardcode an memory location in the instruction itself. The linker starts complaining about this if the compiler decides to do so: "relocation R_ARM_MOVW_ABS_NC against `a local symbol' can not be used" and it is not support by U-boot as well. Prevent their use by requiring word relocations. This allows u-boot to be build at other optimalization levels then -Os. Signed-off-by: Jeroen Hofstee Cc: TigerLiu@viatech.com.cn Cc: Albert ARIBAUD Acked-by: Simon Glass --- arch/arm/config.mk | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/arm/config.mk b/arch/arm/config.mk index 540a119..2277c82 100644 --- a/arch/arm/config.mk +++ b/arch/arm/config.mk @@ -94,7 +94,11 @@ PLATFORM_RELFLAGS += -fno-optimize-sibling-calls endif endif -# check that only R_ARM_RELATIVE relocations are generated ifneq ($(CONFIG_SPL_BUILD),y) -ALL-y += checkarmreloc +# Check that only R_ARM_RELATIVE relocations are generated. +ALL-y += checkarmreloc +# The movt / movw can hardcode 16 bit parts of the addresses in the +# instruction. Relocation is not supported for that case, so disable +# such usage by requiring word relocations. +PLATFORM_CPPFLAGS += $(call cc-option, -mword-relocations) endif