public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] arm: prevent using movt/movw address loads
@ 2013-08-24 11:55 Jeroen Hofstee
  2013-09-17 10:44 ` TigerLiu at viatech.com.cn
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Jeroen Hofstee @ 2013-08-24 11:55 UTC (permalink / raw)
  To: u-boot

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@myspectrum.nl>
Cc: TigerLiu at viatech.com.cn
Cc: Albert ARIBAUD <albert.u.boot@aribaud.net>
---
 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
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 12+ messages in thread
* [U-Boot] [PATCH] arm: prevent using movt/movw address loads
@ 2013-09-17  8:01 TigerLiu at viatech.com.cn
  2013-09-17  8:35 ` Wolfgang Denk
  0 siblings, 1 reply; 12+ messages in thread
From: TigerLiu at viatech.com.cn @ 2013-09-17  8:01 UTC (permalink / raw)
  To: u-boot

Hi, experts:
>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.
Would this patch be included in 2013.10 release verion?
So u-boot could be built at other optimalization levels than -Os.

I tested 2013.10-rc2, but still failed to build by -O0 / -O1 etc.

Best wishes,

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2013-09-23 13:48 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-24 11:55 [U-Boot] [PATCH] arm: prevent using movt/movw address loads Jeroen Hofstee
2013-09-17 10:44 ` TigerLiu at viatech.com.cn
2013-09-17 18:34   ` Jeroen Hofstee
2013-09-19 21:16 ` Tom Rini
2013-09-20 17:15   ` Jeroen Hofstee
2013-09-20 18:03     ` Tom Rini
2013-09-21  2:43 ` Simon Glass
2013-09-23 13:48 ` Albert ARIBAUD
  -- strict thread matches above, loose matches on Subject: below --
2013-09-17  8:01 TigerLiu at viatech.com.cn
2013-09-17  8:35 ` Wolfgang Denk
2013-09-17  9:26   ` TigerLiu at viatech.com.cn
2013-09-17 10:19     ` Wolfgang Denk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox