[ARM] Update selected_cpu based on info got during parsing
authorJiong Wang <jiong.wang@arm.com>
Tue, 26 Aug 2014 15:18:36 +0000 (16:18 +0100)
committerJiong Wang <jiong.wang@arm.com>
Tue, 26 Aug 2014 15:18:36 +0000 (16:18 +0100)
  gas/
    * config/tc-arm.c (aeabi_set_public_attributes): Update intended_arch based
    on the info we got during parsing.
    (arm_handle_align): Make sure the p2align expanding logic under thumb
    unchanged.

  gas/testsuite/
    * gas/arm/blx-bl-convert.d: New testcase.
    * gas/arm/blx-bl-convert.l: Warning expectation.
    * gas/arm/blx-bl-convert.s: Source file.

gas/ChangeLog
gas/config/tc-arm.c
gas/testsuite/ChangeLog
gas/testsuite/gas/arm/blx-bl-convert.d [new file with mode: 0644]
gas/testsuite/gas/arm/blx-bl-convert.l [new file with mode: 0644]
gas/testsuite/gas/arm/blx-bl-convert.s [new file with mode: 0644]

index 5d08734..43f8919 100644 (file)
@@ -1,3 +1,10 @@
+2014-08-26  Jiong Wang  <jiong.wang@arm.com>
+
+       * config/tc-arm.c (aeabi_set_public_attributes): Update selected_cpu
+       based on the info we got during parsing.
+       (arm_handle_align): Make sure the p2align expanding logic under thumb
+       unchanged.
+
 2014-08-26  Maciej W. Rozycki  <macro@codesourcery.com>
 
        * config/tc-mips.c (macro) <M_SAA_AB>: Remove duplicate code and
index 560b4cf..0e6cb7a 100644 (file)
@@ -20848,7 +20848,8 @@ arm_handle_align (fragS * fragP)
 
   if (fragP->tc_frag_data.thumb_mode & (~ MODE_RECORDED))
     {
-      if (ARM_CPU_HAS_FEATURE (selected_cpu, arm_ext_v6t2))
+      if (ARM_CPU_HAS_FEATURE (selected_cpu_name[0]
+                              ? selected_cpu : arm_arch_none, arm_ext_v6t2))
        {
          narrow_noop = thumb_noop[1][target_big_endian];
          noop = wide_thumb_noop[target_big_endian];
@@ -20862,7 +20863,9 @@ arm_handle_align (fragS * fragP)
     }
   else
     {
-      noop = arm_noop[ARM_CPU_HAS_FEATURE (selected_cpu, arm_ext_v6k) != 0]
+      noop = arm_noop[ARM_CPU_HAS_FEATURE (selected_cpu_name[0]
+                                          ? selected_cpu : arm_arch_none,
+                                          arm_ext_v6k) != 0]
                     [target_big_endian];
       noop_size = 4;
 #ifdef OBJ_ELF
@@ -25109,6 +25112,8 @@ aeabi_set_public_attributes (void)
   if (ARM_CPU_HAS_FEATURE (thumb_arch_used, arm_arch_any))
     ARM_MERGE_FEATURE_SETS (flags, flags, arm_ext_v4t);
 
+  selected_cpu = flags;
+
   /* Allow the user to override the reported architecture.  */
   if (object_arch)
     {
index d0b8a9b..096bd41 100644 (file)
@@ -1,3 +1,9 @@
+2014-08-26  Jiong Wang  <jiong.wang@arm.com>
+
+       * gas/arm/blx-bl-convert.d: New testcase.
+       * gas/arm/blx-bl-convert.l: Warning expectation.
+       * gas/arm/blx-bl-convert.s: Source file.
+
 2014-08-26  Maciej W. Rozycki  <macro@codesourcery.com>
 
        * gas/mips/l_d.d: Remove ECOFF offset alternatives.
diff --git a/gas/testsuite/gas/arm/blx-bl-convert.d b/gas/testsuite/gas/arm/blx-bl-convert.d
new file mode 100644 (file)
index 0000000..a30b5a2
--- /dev/null
@@ -0,0 +1,21 @@
+#name: blx->bl convert under no -march/cpu
+#error-output: blx-bl-convert.l
+#objdump: -d
+
+.*:     file format .*
+
+Disassembly of section \.text:
+
+00000000 <entry>:
+   0:  f000 f800       bl      4 <label>
+
+00000004 <label>:
+   4:  4770            bx      lr
+       \.\.\.
+
+00000008 <label2>:
+   8:  ebffffff        bl      c <label3>
+
+0000000c <label3>:
+   c:  e12fff1e        bx      lr
+
diff --git a/gas/testsuite/gas/arm/blx-bl-convert.l b/gas/testsuite/gas/arm/blx-bl-convert.l
new file mode 100644 (file)
index 0000000..c039755
--- /dev/null
@@ -0,0 +1,4 @@
+[^:]*: Assembler messages:
+[^:]*:7: Warning: blx to Thumb func 'label' from Thumb ISA state changed to bl
+[^:]*:16: Warning: blx to 'label3' an ARM ISA state function changed to bl
+
diff --git a/gas/testsuite/gas/arm/blx-bl-convert.s b/gas/testsuite/gas/arm/blx-bl-convert.s
new file mode 100644 (file)
index 0000000..d961233
--- /dev/null
@@ -0,0 +1,20 @@
+.syntax unified
+
+.thumb
+.type entry, %function
+.global entry
+entry:
+  blx label
+
+.type label, %function
+label:
+  bx  lr
+
+.arm
+.type label2, %function
+label2:
+  blx label3
+
+.type label3, %function
+label3:
+  bx  lr