aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/arm/lib1funcs.asm
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/config/arm/lib1funcs.asm')
-rw-r--r--gcc/config/arm/lib1funcs.asm41
1 files changed, 30 insertions, 11 deletions
diff --git a/gcc/config/arm/lib1funcs.asm b/gcc/config/arm/lib1funcs.asm
index ecd30ad0f4a..2bab2772209 100644
--- a/gcc/config/arm/lib1funcs.asm
+++ b/gcc/config/arm/lib1funcs.asm
@@ -94,10 +94,20 @@ Boston, MA 02111-1307, USA. */
# define RET bx lr
# define RETc(x) bx##x lr
-# if (__ARM_ARCH__ == 4) \
- && (defined(__thumb__) || defined(__THUMB_INTERWORK__))
-# define __INTERWORKING__
-# endif
+/* Special precautions for interworking on armv4t. */
+# if (__ARM_ARCH__ == 4)
+
+/* Always use bx, not ldr pc. */
+# if (defined(__thumb__) || defined(__THUMB_INTERWORK__))
+# define __INTERWORKING__
+# endif /* __THUMB__ || __THUMB_INTERWORK__ */
+
+/* Include thumb stub before arm mode code. */
+# if defined(__thumb__) && !defined(__THUMB_INTERWORK__)
+# define __INTERWORKING_STUBS__
+# endif /* __thumb__ && !__THUMB_INTERWORK__ */
+
+#endif /* __ARM_ARCH == 4 */
#else
@@ -192,7 +202,7 @@ SYM (__\name):
/* Special function that will always be coded in ARM assembly, even if
in Thumb-only compilation. */
-#if defined(__thumb__) && !defined(__THUMB_INTERWORK__)
+#if defined(__INTERWORKING_STUBS__)
.macro ARM_FUNC_START name
FUNC_START \name
bx pc
@@ -226,11 +236,20 @@ SYM (__\name):
.macro ARM_FUNC_ALIAS new old
.globl SYM (__\new)
EQUIV SYM (__\new), SYM (__\old)
-#ifdef __thumb__
+#if defined(__INTERWORKING_STUBS__)
.set SYM (_L__\new), SYM (_L__\old)
#endif
.endm
+.macro FUNC_ALIAS new old
+ .globl SYM (__\new)
+#if defined (__thumb__)
+ .thumb_set SYM (__\new), SYM (__\old)
+#else
+ .set SYM (__\new), SYM (__\old)
+#endif
+.endm
+
#ifdef __thumb__
/* Register aliases. */
@@ -885,8 +904,8 @@ LSYM(Lover12):
#ifdef L_dvmd_tls
FUNC_START div0
- ARM_FUNC_ALIAS aeabi_idiv0 div0
- ARM_FUNC_ALIAS aeabi_ldiv0 div0
+ FUNC_ALIAS aeabi_idiv0 div0
+ FUNC_ALIAS aeabi_ldiv0 div0
RET
@@ -942,7 +961,7 @@ LSYM(Lover12):
#ifdef L_lshrdi3
FUNC_START lshrdi3
- ARM_FUNC_ALIAS aeabi_llsr lshrdi3
+ FUNC_ALIAS aeabi_llsr lshrdi3
#ifdef __thumb__
lsr al, r2
@@ -974,7 +993,7 @@ LSYM(Lover12):
#ifdef L_ashrdi3
FUNC_START ashrdi3
- ARM_FUNC_ALIAS aeabi_lasr ashrdi3
+ FUNC_ALIAS aeabi_lasr ashrdi3
#ifdef __thumb__
lsr al, r2
@@ -1011,7 +1030,7 @@ LSYM(Lover12):
#ifdef L_ashldi3
FUNC_START ashldi3
- ARM_FUNC_ALIAS aeabi_llsl ashldi3
+ FUNC_ALIAS aeabi_llsl ashldi3
#ifdef __thumb__
lsl ah, r2