about summary refs log tree commit diff
path: root/ports/sysdeps/arm/sysdep.h
diff options
context:
space:
mode:
authorRichard Henderson <rth@twiddle.net>2013-02-14 21:45:50 -0800
committerRichard Henderson <rth@twiddle.net>2013-03-06 07:46:46 -0800
commit46dede0c00285bb43890ed68c0b8572e855b54e2 (patch)
treed7afc72e1db93ab766b9a4f98ea362e2a143913e /ports/sysdeps/arm/sysdep.h
parent92cc8e332bb3b9b24d2ba581e40d4433594841be (diff)
downloadglibc-46dede0c00285bb43890ed68c0b8572e855b54e2.tar.gz
glibc-46dede0c00285bb43890ed68c0b8572e855b54e2.tar.xz
glibc-46dede0c00285bb43890ed68c0b8572e855b54e2.zip
arm: Commonize BX conditionals
Add BLX macro in addition and use it where appropriate.
Diffstat (limited to 'ports/sysdeps/arm/sysdep.h')
-rw-r--r--ports/sysdeps/arm/sysdep.h29
1 files changed, 13 insertions, 16 deletions
diff --git a/ports/sysdeps/arm/sysdep.h b/ports/sysdeps/arm/sysdep.h
index 5f6c3f2a45..84313fecd4 100644
--- a/ports/sysdeps/arm/sysdep.h
+++ b/ports/sysdeps/arm/sysdep.h
@@ -33,26 +33,23 @@
 
 #define PLTJMP(_x)	_x##(PLT)
 
-/* APCS-32 doesn't preserve the condition codes across function call. */
-#ifdef __APCS_32__
 #ifdef __USE_BX__
-#define RETINSTR(cond, reg)	\
-	bx##cond	reg
-#define DO_RET(_reg)		\
-	bx _reg
+# define BX(R)		bx	R
+# define BXC(C, R)	bx##C	R
+# ifdef __ARM_ARCH_4T__
+#  define BLX(R)	mov	lr, pc; bx R
+# else
+#  define BLX(R)	blx	R
+# endif
 #else
-#define RETINSTR(cond, reg)	\
-	mov##cond	pc, reg
-#define DO_RET(_reg)		\
-	mov pc, _reg
-#endif
-#else  /* APCS-26 */
-#define RETINSTR(cond, reg)	\
-	mov##cond##s	pc, reg
-#define DO_RET(_reg)		\
-	movs pc, _reg
+# define BX(R)		mov	pc, R
+# define BXC(C, R)	mov##C	pc, R
+# define BLX(R)		mov	lr, pc; mov pc, R
 #endif
 
+#define DO_RET(R)	BX(R)
+#define RETINSTR(C, R)	BXC(C, R)
+
 /* Define an entry point visible from C.  */
 #define	ENTRY(name)					\
 	.globl	C_SYMBOL_NAME(name);			\