From mboxrd@z Thu Jan 1 00:00:00 1970 From: Albert ARIBAUD Date: Mon, 23 Sep 2013 15:48:44 +0200 Subject: [U-Boot] [PATCH] arm: prevent using movt/movw address loads In-Reply-To: <1377345338-9695-1-git-send-email-jeroen@myspectrum.nl> References: <1377345338-9695-1-git-send-email-jeroen@myspectrum.nl> Message-ID: <20130923154844.10d4ff54@lilith> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Jeroen, On Sat, 24 Aug 2013 13:55:38 +0200, Jeroen Hofstee wrote: > 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 at viatech.com.cn > Cc: Albert ARIBAUD > --- > 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 Applied as a bugfix to u-boot-arm/master, thanks! Amicalement, -- Albert.