summaryrefslogtreecommitdiffstats
path: root/libgloss
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2011-09-29 11:06:49 +0000
committerNick Clifton <nickc@redhat.com>2011-09-29 11:06:49 +0000
commit29deef8805ffa069090f191a22ec7538649cd70f (patch)
tree789fa8bd6cfbf6b397cfd651b8a1b6d63ac84447 /libgloss
parent8a91ddb36763aab9339bba50e6da3ebc796ceaef (diff)
downloadcygnal-29deef8805ffa069090f191a22ec7538649cd70f.tar.gz
cygnal-29deef8805ffa069090f191a22ec7538649cd70f.tar.bz2
cygnal-29deef8805ffa069090f191a22ec7538649cd70f.zip
* arm/arm.h (HAVE_CALL_INDIRECT): Define.
* arm/crt0.S (indirect_call): New macro. Encodes indirect function calls. Does not use blx for pre-armv5 targets.
Diffstat (limited to 'libgloss')
-rw-r--r--libgloss/ChangeLog6
-rw-r--r--libgloss/arm/arm.h9
-rw-r--r--libgloss/arm/crt0.S24
3 files changed, 27 insertions, 12 deletions
diff --git a/libgloss/ChangeLog b/libgloss/ChangeLog
index fcdb5f513..afea6bb46 100644
--- a/libgloss/ChangeLog
+++ b/libgloss/ChangeLog
@@ -1,3 +1,9 @@
+2011-09-29 Bin Cheng <bin.cheng@arm.com>
+
+ * arm/arm.h (HAVE_CALL_INDIRECT): Define.
+ * arm/crt0.S (indirect_call): New macro. Encodes indirect
+ function calls. Does not use blx for pre-armv5 targets.
+
2011-08-19 Nick Clifton <nickc@redhat.com>
* iq2000/sim.ld (.gcc_except_table): Include .gcc_except_table.foo
diff --git a/libgloss/arm/arm.h b/libgloss/arm/arm.h
index e8c9d25a3..26a1ff110 100644
--- a/libgloss/arm/arm.h
+++ b/libgloss/arm/arm.h
@@ -50,4 +50,13 @@
# define THUMB_V7M_V6M
#endif
+/* Defined if this target supports the BLX Rm instruction. */
+#if !defined(__ARM_ARCH_2__) \
+ && !defined(__ARM_ARCH_3__) \
+ && !defined(__ARM_ARCH_3M__) \
+ && !defined(__ARM_ARCH_4__) \
+ && !defined(__ARM_ARCH_4T__)
+# define HAVE_CALL_INDIRECT
+#endif
+
#endif /* _LIBGLOSS_ARM_H */
diff --git a/libgloss/arm/crt0.S b/libgloss/arm/crt0.S
index c98cd2cab..748985070 100644
--- a/libgloss/arm/crt0.S
+++ b/libgloss/arm/crt0.S
@@ -34,6 +34,16 @@
\name:
.endm
#endif
+
+.macro indirect_call reg
+#ifdef HAVE_CALL_INDIRECT
+ blx \reg
+#else
+ mov lr, pc
+ mov pc, \reg
+#endif
+.endm
+
.align 0
FUNC_START _mainCRTStartup
@@ -213,22 +223,12 @@ __change_mode:
ldr r3, .Lhwinit
cmp r3, #0
beq .LC24
-#if defined(__thumb__) || defined(__thumb2__)
- blx r3
-#else
- mov lr, pc
- mov pc, r3
-#endif
+ indirect_call r3
.LC24:
ldr r3, .Lswinit
cmp r3, #0
beq .LC25
-#if defined(__thumb__) || defined(__thumb2__)
- blx r3
-#else
- mov lr, pc
- mov pc, r3
-#endif
+ indirect_call r3
.LC25:
movs r0, #0 /* no arguments */