From 9ccbb16fd4985e94b44b3e98b5f25c27986f0ef8 Mon Sep 17 00:00:00 2001 From: Matthew Gretton-Dann Date: Mon, 15 Nov 2010 15:40:08 +0000 Subject: [PATCH] PR gas/12198 * gas/config/tc-arm.c (arm_arch_v6m_only): New variable. (aeabi_set_public_attributes): Ensure we only set the Operating System Extension when we are on an M-profile core. * gas/testsuite/gas/arm/pr12198-1.d: New test. * gas/testsuite/gas/arm/pr12918-1.s: Likewise. * gas/testsuite/gas/arm/pr12198-2.d: Likewise. * gas/testsuite/gas/arm/pr12918-2.s: Likewise. * include/opcode/arm.h (ARM_AEXT_V6M_ONLY): New define. (ARM_AEXT_V6M): Rewrite in terms of ARM_AEXT_V6M_ONLY. (ARM_ARCH_V6M_ONLY): New define. --- gas/ChangeLog | 7 +++++++ gas/config/tc-arm.c | 7 +++++++ gas/testsuite/ChangeLog | 8 ++++++++ include/opcode/ChangeLog | 7 +++++++ include/opcode/arm.h | 7 +++++-- 5 files changed, 34 insertions(+), 2 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 9fee2731038..679c43588ff 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,10 @@ +2010-11-15 Matthew Gretton-Dann + + PR gas/12198 + * config/tc-arm.c (arm_arch_v6m_only): New variable. + (aeabi_set_public_attributes): Ensure we only set the Operating System + Extension when we are on an M-profile core. + 2010-11-10 Richard Sandiford * config/tc-arm.c (do_t_branch): Treat (PLT) branches as wide. diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index 9a8734293ce..f4ebdc4e249 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -207,6 +207,7 @@ static const arm_feature_set arm_arch_any = ARM_ANY; static const arm_feature_set arm_arch_full = ARM_FEATURE (-1, -1); static const arm_feature_set arm_arch_t2 = ARM_ARCH_THUMB2; static const arm_feature_set arm_arch_none = ARM_ARCH_NONE; +static const arm_feature_set arm_arch_v6m_only = ARM_ARCH_V6M_ONLY; static const arm_feature_set arm_cext_iwmmxt2 = ARM_FEATURE (0, ARM_CEXT_IWMMXT2); @@ -23232,6 +23233,12 @@ aeabi_set_public_attributes (void) ARM_MERGE_FEATURE_SETS (flags, flags, *object_arch); } + /* We need to make sure that the attributes do not identify us as v6S-M + when the only v6S-M feature in use is the Operating System Extensions. */ + if (ARM_CPU_HAS_FEATURE (flags, arm_ext_os)) + if (!ARM_CPU_HAS_FEATURE (flags, arm_arch_v6m_only)) + ARM_CLEAR_FEATURE (flags, flags, arm_ext_os); + tmp = flags; arch = 0; for (p = cpu_arch_ver; p->val; p++) diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 67c93ee08d1..995fd1de31d 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2010-11-15 Matthew Gretton-Dann + + PR gas/12198 + * gas/arm/pr12198-1.d: New test. + * gas/arm/pr12918-1.s: Likewise. + * gas/arm/pr12198-2.d: Likewise. + * gas/arm/pr12918-2.s: Likewise. + 2010-11-10 Richard Sandiford * gas/arm/plt-1.s, gas/arm/plt-1.d: New test. diff --git a/include/opcode/ChangeLog b/include/opcode/ChangeLog index d7e7c626871..a275b99284e 100644 --- a/include/opcode/ChangeLog +++ b/include/opcode/ChangeLog @@ -1,3 +1,10 @@ +2010-11-15 Matthew Gretton-Dann + + PR gas/12198 + * arm.h (ARM_AEXT_V6M_ONLY): New define. + (ARM_AEXT_V6M): Rewrite in terms of ARM_AEXT_V6M_ONLY. + (ARM_ARCH_V6M_ONLY): New define. + 2010-10-09 Matt Rice * cgen.h (CGEN_ATTR, CGEN_ATTR_TYPE): Rename bool attribute to bool_. diff --git a/include/opcode/arm.h b/include/opcode/arm.h index 0bfd3028842..50bc726a60f 100644 --- a/include/opcode/arm.h +++ b/include/opcode/arm.h @@ -115,9 +115,10 @@ #define ARM_AEXT_NOTM \ (ARM_AEXT_V4 | ARM_EXT_V5ExP | ARM_EXT_V5J | ARM_EXT_V6_NOTM \ | ARM_EXT_V6_DSP ) +#define ARM_AEXT_V6M_ONLY \ + ((ARM_EXT_BARRIER | ARM_EXT_V6M | ARM_EXT_THUMB_MSR) & ~(ARM_AEXT_NOTM)) #define ARM_AEXT_V6M \ - ((ARM_AEXT_V6K | ARM_EXT_BARRIER | ARM_EXT_V6M | ARM_EXT_THUMB_MSR) \ - & ~(ARM_AEXT_NOTM)) + ((ARM_AEXT_V6K | ARM_AEXT_V6M_ONLY) & ~(ARM_AEXT_NOTM)) #define ARM_AEXT_V6SM (ARM_AEXT_V6M | ARM_EXT_OS) #define ARM_AEXT_V7M \ ((ARM_AEXT_V7_ARM | ARM_EXT_V6M | ARM_EXT_V7M | ARM_EXT_DIV) \ @@ -228,6 +229,8 @@ ARM_FEATURE (ARM_AEXT_V7A | ARM_EXT_MP | ARM_EXT_SEC \ | ARM_EXT_DIV | ARM_EXT_ADIV \ | ARM_EXT_VIRT, 0) +/* Features that are present in v6M and v6S-M but not other v6 cores. */ +#define ARM_ARCH_V6M_ONLY ARM_FEATURE (ARM_AEXT_V6M_ONLY, 0) /* There are too many feature bits to fit in a single word, so use a structure. For simplicity we put all core features in one word and -- 2.47.3