This is the mail archive of the libc-ports@sources.redhat.com mailing list for the libc-ports project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Do not use 'bx' on armv4


armv4 has no thumb support and instruction 'bx'. Use 'mov pc' instead if
__USE_BX__ is not defined.

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
---
 sysdeps/arm/eabi/machine-gmon.h                    |   10 ++++++++--
 .../sysv/linux/arm/eabi/nptl/unwind-forcedunwind.c |    4 ++++
 .../unix/sysv/linux/arm/eabi/nptl/unwind-resume.c  |    4 ++++
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/sysdeps/arm/eabi/machine-gmon.h b/sysdeps/arm/eabi/machine-gmon.h
index 189a9a3..c425b51 100644
--- a/sysdeps/arm/eabi/machine-gmon.h
+++ b/sysdeps/arm/eabi/machine-gmon.h
@@ -23,6 +23,12 @@
 #include <sysdep.h>
 static void mcount_internal (u_long frompc, u_long selfpc) __attribute_used__;

+#if defined(__USE_BX__)
+#define BX(x) "bx\t" #x
+#else
+#define BX(x) "mov\tpc, " #x
+#endif
+
 #define _MCOUNT_DECL(frompc, selfpc) \
 static void mcount_internal (u_long frompc, u_long selfpc)

@@ -50,7 +56,7 @@ void __attribute__((__naked__)) __gnu_mcount_nc(void)			\
 	 "ldr r0, [sp, #20]\n\t"					\
 	 "bl mcount_internal\n\t"					\
 	 "pop {r0, r1, r2, r3, ip, lr}\n\t"				\
-	 "bx ip");							\
+	 BX(ip));							\
 }									\
 OLD_MCOUNT

@@ -93,7 +99,7 @@ void __attribute__((__naked__)) _mcount (void)				\
 	  "movnes	r1, lr;"					\
 	  "blne		mcount_internal;"				\
 	  "ldmia	sp!, {r0, r1, r2, r3, fp, lr};"			\
-	  "bx		lr");						\
+	  BX(lr));							\
 }

 #endif
diff --git a/sysdeps/unix/sysv/linux/arm/eabi/nptl/unwind-forcedunwind.c
b/sysdeps/unix/sysv/linux/arm/eabi/nptl/unwind-forcedunwind.c
index ed321a3..441f150 100644
--- a/sysdeps/unix/sysv/linux/arm/eabi/nptl/unwind-forcedunwind.c
+++ b/sysdeps/unix/sysv/linux/arm/eabi/nptl/unwind-forcedunwind.c
@@ -99,7 +99,11 @@ asm (
 "	beq	4f\n"
 "5:	mov	r0, r6\n"
 "	ldmfd	sp!, {r4, r5, r6, lr}\n"
+#ifdef __USE_BX__
 "	bx	r3\n"
+#else
+"	mov	pc, r3\n"
+#endif
 "4:	bl	pthread_cancel_init\n"
 "	ldr	r3, [r4, r5]\n"
 "	b	5b\n"
diff --git a/sysdeps/unix/sysv/linux/arm/eabi/nptl/unwind-resume.c
b/sysdeps/unix/sysv/linux/arm/eabi/nptl/unwind-resume.c
index 3c780b7..c4269a5 100644
--- a/sysdeps/unix/sysv/linux/arm/eabi/nptl/unwind-resume.c
+++ b/sysdeps/unix/sysv/linux/arm/eabi/nptl/unwind-resume.c
@@ -62,7 +62,11 @@ asm (
 "	beq	4f\n"
 "5:	mov	r0, r6\n"
 "	ldmfd	sp!, {r4, r5, r6, lr}\n"
+#ifdef __USE_BX__
 "	bx	r3\n"
+#else
+"	mov	pc, r3\n"
+#endif
 "4:	bl	init\n"
 "	ldr	r3, [r4, r5]\n"
 "	b	5b\n"
-- 
1.6.4.4


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]