arm: Tidy architecture selection

This commit is contained in:
Richard Henderson 2013-02-27 13:33:09 -08:00
parent d137b6dc52
commit 3377126b0a
3 changed files with 45 additions and 8 deletions

View File

@ -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.

View File

@ -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

View File

@ -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