[U-Boot] [PATCH] arm: prevent using movt/movw address loads

Tom Rini trini at ti.com
Fri Sep 20 20:03:13 CEST 2013


On Fri, Sep 20, 2013 at 07:15:29PM +0200, Jeroen Hofstee wrote:
> Hello Tom,
> 
> On 09/19/2013 11:16 PM, Tom Rini wrote:
> >On Sat, Aug 24, 2013 at 01:55:38PM +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 <jeroen at myspectrum.nl>
> >>Cc: TigerLiu at viatech.com.cn
> >>Cc: Albert ARIBAUD <albert.u.boot at aribaud.net>
> >>---
> >>  arch/arm/config.mk | 8 ++++++--
> >>  1 file changed, 6 insertions(+), 2 deletions(-)
> >Is this also something we need for llvm?
> 
> You guessed that right, for clang actually (llvm has
> already been taught to not emit movw/movt pairs,
> when requested not to do so). So with the
> -mword-relocations || present I can teach clang to tell llvm
> not to do it.
> 
> I am not aware of any reason why gcc could not
> decide to do the same in future releases. A pointer
> comparison e.g. is of exactly the same size (afaik).
> In this case U-boot will no longer compile without
> mentioned flag.

OK.

[snip]
> >If there's some -O2 enabled gcc flag we want because of
> >a measurable performance win, we should add it specifically to -Os.
> >
> First of all the default -Os is unchanged and I have no
> intention to change it. -O2 won't build without the patch
> last time I checked ;)
> 
> Anyway, I like the flag since it helps to not special case
> clang and it guarantees builds with gcc at all optimisation
> levels, now and in the future. I don't care if it goes in this
> release or the next one.

Right, I'm OK picking this patch up then, on the grounds of making
clang/llvm work now, and potentially keeping a future gcc happy.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130920/3f1d0eca/attachment.pgp>


More information about the U-Boot mailing list