This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH][ARM][2/2] Update intended_arch based on info got during parsing


this patch update intended_arch based on the info got during parsing.

and naturally fix the hiding bugs exposed by the new added testcase.
  * should convert blx to bl under arm->arm transfer.
  * wrong relocation calculation against local symbol.

on issue introduced by this patch is *.p2align compatibility*. previously
if the user has not specify arch through cmdline or directive, then
.p2align will always be expanded into 2byte nop under thumb mode?

but because the handling of .p2align is actually done via relax, so
it's after parsing stage, thus after this patch, .p2align is not
always expanded into 2byte nop under thumb mode, this patch keeps
the original thumb nop expanding logic untouched.

no regression on arm-none-eabi full test with multilib enabled.

OK to install ?

thanks.

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

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.
From c417826b274f120ee4ba6e9c861296436a4aee57 Mon Sep 17 00:00:00 2001
From: Jiong Wang <jiong.wang@arm.com>
Date: Tue, 12 Aug 2014 14:59:40 +0100
Subject: [PATCH 2/2] [ARM/GAS] Update intended_arch based on what we got
 during parsing

---
 gas/config/tc-arm.c                    |    9 +++++++--
 gas/testsuite/gas/arm/blx-bl-convert.d |   21 +++++++++++++++++++++
 gas/testsuite/gas/arm/blx-bl-convert.l |    4 ++++
 gas/testsuite/gas/arm/blx-bl-convert.s |   20 ++++++++++++++++++++
 4 files changed, 52 insertions(+), 2 deletions(-)
 create mode 100644 gas/testsuite/gas/arm/blx-bl-convert.d
 create mode 100644 gas/testsuite/gas/arm/blx-bl-convert.l
 create mode 100644 gas/testsuite/gas/arm/blx-bl-convert.s

diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index 5760b77..266f39d 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -20804,7 +20804,8 @@ arm_handle_align (fragS * fragP)
 
   if (fragP->tc_frag_data.thumb_mode & (~ MODE_RECORDED))
     {
-      if (ARM_CPU_HAS_FEATURE (intended_arch, arm_ext_v6t2))
+      if (ARM_CPU_HAS_FEATURE (intended_arch_name[0]
+			       ? intended_arch : arm_arch_none, arm_ext_v6t2))
 	{
 	  narrow_noop = thumb_noop[1][target_big_endian];
 	  noop = wide_thumb_noop[target_big_endian];
@@ -20818,7 +20819,9 @@ arm_handle_align (fragS * fragP)
     }
   else
     {
-      noop = arm_noop[ARM_CPU_HAS_FEATURE (intended_arch, arm_ext_v6k) != 0]
+      noop = arm_noop[ARM_CPU_HAS_FEATURE (intended_arch_name[0]
+					   ? intended_arch : arm_arch_none,
+					   arm_ext_v6k) != 0]
 		     [target_big_endian];
       noop_size = 4;
 #ifdef OBJ_ELF
@@ -25065,6 +25068,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);
 
+  intended_arch = flags;
+
   /* Allow the user to override the reported architecture.  */
   if (object_arch)
     {
diff --git a/gas/testsuite/gas/arm/blx-bl-convert.d b/gas/testsuite/gas/arm/blx-bl-convert.d
new file mode 100644
index 0000000..a30b5a2
--- /dev/null
+++ b/gas/testsuite/gas/arm/blx-bl-convert.d
@@ -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
index 0000000..c039755
--- /dev/null
+++ b/gas/testsuite/gas/arm/blx-bl-convert.l
@@ -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
index 0000000..d961233
--- /dev/null
+++ b/gas/testsuite/gas/arm/blx-bl-convert.s
@@ -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
-- 
1.7.9.5

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]