about summary refs log tree commit diff
path: root/ports
diff options
context:
space:
mode:
authorRichard Henderson <rth@twiddle.net>2013-02-27 13:33:09 -0800
committerRichard Henderson <rth@twiddle.net>2013-03-06 07:46:47 -0800
commit3377126b0a055e6addaa6bd69f51dd557d774b99 (patch)
treeb0099f8a9a3ddb08ee6c57970e97528f8496578b /ports
parentd137b6dc52efbb0a55baba8e8851e930cc781217 (diff)
downloadglibc-3377126b0a055e6addaa6bd69f51dd557d774b99.tar.gz
glibc-3377126b0a055e6addaa6bd69f51dd557d774b99.tar.xz
glibc-3377126b0a055e6addaa6bd69f51dd557d774b99.zip
arm: Tidy architecture selection
Diffstat (limited to 'ports')
-rw-r--r--ports/ChangeLog.arm7
-rw-r--r--ports/sysdeps/arm/dl-machine.h2
-rw-r--r--ports/sysdeps/arm/sysdep.h44
3 files changed, 45 insertions, 8 deletions
diff --git a/ports/ChangeLog.arm b/ports/ChangeLog.arm
index 400a7db517..2c3f220e13 100644
--- a/ports/ChangeLog.arm
+++ b/ports/ChangeLog.arm
@@ -1,5 +1,12 @@
 2013-03-06  Richard Henderson <rth@redhat.com>
 
+	* sysdeps/arm/sysdep.h (__ARM_ARCH): New macro.
+	(ARCH_HAS_BX, ARCH_HAS_BLX, ARCH_HAS_T2): New macros.
+	(BX): Select on ARCH_HAS_BX instead of __USE_BX__.
+	(BLX): Select on ARCH_HAS_BLX instead of __ARM_ARCH_4T__.
+	* ports/sysdeps/arm/dl-machine.h (BX): Select on ARCH_HAS_BX
+	instead of __USE_BX__.
+
 	* sysdeps/arm/arm-mcount.S (_mcount): Use pop into pc unless
 	__ARM_ARCH_4T__ and __THUMB_INTERWORK__.
 	* sysdeps/arm/dl-tlsdesc.S (_dl_tlsdesc_dynamic): Likewise.
diff --git a/ports/sysdeps/arm/dl-machine.h b/ports/sysdeps/arm/dl-machine.h
index 30ad46c255..5a424f841f 100644
--- a/ports/sysdeps/arm/dl-machine.h
+++ b/ports/sysdeps/arm/dl-machine.h
@@ -136,7 +136,7 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
   return lazy;
 }
 
-#if defined(__USE_BX__)
+#if defined(ARCH_HAS_BX)
 #define BX(x) "bx\t" #x
 #else
 #define BX(x) "mov\tpc, " #x
diff --git a/ports/sysdeps/arm/sysdep.h b/ports/sysdeps/arm/sysdep.h
index 84313fecd4..156bc01734 100644
--- a/ports/sysdeps/arm/sysdep.h
+++ b/ports/sysdeps/arm/sysdep.h
@@ -19,9 +19,39 @@
 #include <sysdeps/generic/sysdep.h>
 #include <features.h>
 
-#if (!defined (__ARM_ARCH_2__) && !defined (__ARM_ARCH_3__) \
-     && !defined (__ARM_ARCH_3M__) && !defined (__ARM_ARCH_4__))
-# define __USE_BX__
+/* The __ARM_ARCH define is provided by gcc 4.8.  Construct it otherwise.  */
+#ifndef __ARM_ARCH
+# ifdef __ARM_ARCH_2__
+#  define __ARM_ARCH 2
+# elif defined (__ARM_ARCH_3__) || defined (__ARM_ARCH_3M__)
+#  define __ARM_ARCH 3
+# elif defined (__ARM_ARCH_4__) || defined (__ARM_ARCH_4T__)
+#  define __ARM_ARCH 4
+# elif defined (__ARM_ARCH_5__) || defined (__ARM_ARCH_5E__) \
+       || defined(__ARM_ARCH_5T__) || defined(__ARM_ARCH_5TE__) \
+       || defined(__ARM_ARCH_5TEJ__)
+#  define __ARM_ARCH 5
+# elif defined (__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \
+       || defined (__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) \
+       || defined (__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__)
+#  define __ARM_ARCH 6
+# elif defined (__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \
+       || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) \
+       || defined(__ARM_ARCH_7EM__)
+#  define __ARM_ARCH 7
+# else
+#  error unknown arm architecture
+# endif
+#endif
+
+#if __ARM_ARCH > 4 || defined (__ARM_ARCH_4T__)
+# define ARCH_HAS_BX
+#endif
+#if __ARM_ARCH > 4
+# define ARCH_HAS_BLX
+#endif
+#if __ARM_ARCH > 6 || defined (__ARM_ARCH_6T2__)
+# define ARCH_HAS_T2
 #endif
 
 #ifdef	__ASSEMBLER__
@@ -33,13 +63,13 @@
 
 #define PLTJMP(_x)	_x##(PLT)
 
-#ifdef __USE_BX__
+#ifdef ARCH_HAS_BX
 # 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
+# ifdef ARCH_HAS_BLX
 #  define BLX(R)	blx	R
+# else
+#  define BLX(R)	mov	lr, pc; bx R
 # endif
 #else
 # define BX(R)		mov	pc, R