[U-Boot] [PATCH] armv5te: make 'ret lr' produce iinterworking 'bx lr'

Albert ARIBAUD albert.u.boot at aribaud.net
Mon Feb 27 19:19:07 UTC 2017


Current ARM assembler helper for the 'return to caller' pseudo-instruction
turns 'ret lr' into 'mov pc, lr' for ARMv5TE. This causes the core to remain
in its current ARM state even when the routine doing the 'ret' was called
from Thumb-1 state, triggering an undefined instruction exception.

This causes early run-time failures in all boards compiled using the Thumb-1
instruction set (for instance the Open-RD family).

ARMv5TE supports 'bx lr' which properly implements interworking and thus
correctly returns to Thumb-1 state from ARM state.

This change makes 'ret lr' turn into 'bx lr' for ARMv5TE.

Signed-off-by: Albert ARIBAUD <albert.u.boot at aribaud.net>
---
Note: this patch supersedes patch "openrd: disable private arch memset,
memcpy and libgcc" dated Sun, 26 Feb 2017 16:29:32 +0100.

 arch/arm/include/asm/assembler.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h
index ae1e42fc06..c56daf2a1f 100644
--- a/arch/arm/include/asm/assembler.h
+++ b/arch/arm/include/asm/assembler.h
@@ -59,7 +59,7 @@
 
 	.irp	c,,eq,ne,cs,cc,mi,pl,vs,vc,hi,ls,ge,lt,gt,le,hs,lo
 	.macro	ret\c, reg
-#if defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__)
+#if defined(__ARM_ARCH_5E__)
 	mov\c	pc, \reg
 #else
 	.ifeqs	"\reg", "lr"
-- 
2.11.0



More information about the U-Boot mailing list