This is the mail archive of the binutils-cvs@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]

[binutils-gdb] [ARM]Fix "align directive causes MAP_DATA symbol to be lost"


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=4e9aaefbd0042f5372509cd51ef2791a68aa30b0

commit 4e9aaefbd0042f5372509cd51ef2791a68aa30b0
Author: Sterling Augustine <augustine.sterling@gmail.com>
Date:   Tue Mar 10 11:34:50 2015 +0000

    [ARM]Fix "align directive causes MAP_DATA symbol to be lost"
    
    gas/
    2015-03-10  Renlin Li  <renlin.li@arm.com>
    
    	* config/tc-arm.c (mapping_state): Remove first MAP_DATA emitting code.
    	(mapping_state_2): Emit first MAP_DATA symbol here.
    
    gas/testsuite/
    2015-03-05  Renlin Li  <renlin.li@arm.com>
    
    	* gas/arm/dis-data.d: Adjust the desired output.
    	* gas/arm/dis-data2.d: Ditto.

Diff:
---
 gas/ChangeLog                     |  5 +++++
 gas/config/tc-arm.c               | 30 +++++++++++++-----------------
 gas/testsuite/ChangeLog           |  9 ++++++++-
 gas/testsuite/gas/arm/dis-data.d  |  6 +++---
 gas/testsuite/gas/arm/dis-data2.d |  6 +++---
 5 files changed, 32 insertions(+), 24 deletions(-)

diff --git a/gas/ChangeLog b/gas/ChangeLog
index e52702c..992eee5 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,8 @@
+2015-03-10  Renlin Li  <renlin.li@arm.com>
+
+	* config/tc-arm.c (mapping_state): Remove first MAP_DATA emitting code.
+	(mapping_state_2): Emit first MAP_DATA symbol here.
+
 2015-03-10  Matthew Wahab  <matthew.wahab@arm.com>
 
 	* config/tc-aarch64.c (mapping_state): Set minimum alignment for
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index c5e627c..ded989a 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -2632,13 +2632,12 @@ static void mapping_state_2 (enum mstate state, int max_chars);
 /* Set the mapping state to STATE.  Only call this when about to
    emit some STATE bytes to the file.  */
 
+#define TRANSITION(from, to) (mapstate == (from) && state == (to))
 void
 mapping_state (enum mstate state)
 {
   enum mstate mapstate = seg_info (now_seg)->tc_segment_info_data.mapstate;
 
-#define TRANSITION(from, to) (mapstate == (from) && state == (to))
-
   if (mapstate == state)
     /* The mapping symbol has already been emitted.
        There is nothing else to do.  */
@@ -2661,24 +2660,10 @@ mapping_state (enum mstate state)
     record_alignment (now_seg, state == MAP_ARM ? 2 : 1);
 
   if (TRANSITION (MAP_UNDEFINED, MAP_DATA))
-    /* This case will be evaluated later in the next else.  */
+    /* This case will be evaluated later.  */
     return;
-  else if (TRANSITION (MAP_UNDEFINED, MAP_ARM)
-	  || TRANSITION (MAP_UNDEFINED, MAP_THUMB))
-    {
-      /* Only add the symbol if the offset is > 0:
-	 if we're at the first frag, check it's size > 0;
-	 if we're not at the first frag, then for sure
-	    the offset is > 0.  */
-      struct frag * const frag_first = seg_info (now_seg)->frchainP->frch_root;
-      const int add_symbol = (frag_now != frag_first) || (frag_now_fix () > 0);
-
-      if (add_symbol)
-	make_mapping_symbol (MAP_DATA, (valueT) 0, frag_first);
-    }
 
   mapping_state_2 (state, 0);
-#undef TRANSITION
 }
 
 /* Same as mapping_state, but MAX_CHARS bytes have already been
@@ -2697,9 +2682,20 @@ mapping_state_2 (enum mstate state, int max_chars)
        There is nothing else to do.  */
     return;
 
+  if (TRANSITION (MAP_UNDEFINED, MAP_ARM)
+	  || TRANSITION (MAP_UNDEFINED, MAP_THUMB))
+    {
+      struct frag * const frag_first = seg_info (now_seg)->frchainP->frch_root;
+      const int add_symbol = (frag_now != frag_first) || (frag_now_fix () > 0);
+
+      if (add_symbol)
+	make_mapping_symbol (MAP_DATA, (valueT) 0, frag_first);
+    }
+
   seg_info (now_seg)->tc_segment_info_data.mapstate = state;
   make_mapping_symbol (state, (valueT) frag_now_fix () - max_chars, frag_now);
 }
+#undef TRANSITION
 #else
 #define mapping_state(x) ((void)0)
 #define mapping_state_2(x, y) ((void)0)
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index 25f560a..03440c6 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,8 +1,15 @@
+2015-03-05  Renlin Li  <renlin.li@arm.com>
+
+	* gas/arm/dis-data.d: Adjust the desired output.
+	* gas/arm/dis-data2.d: Ditto.
+
 2015-03-10  Renlin Li  <renlin.li@arm.com>
 
 	* gas/aarch64/ldst-reg-uns-imm.d: Adjust expected output.
 	* gas/aarch64/ldst-reg-unscaled-imm.d: Likewise.
-	* gas/aarch64/reloc-insn.d: Likewise.2015-03-10  Matthew Wahab  <matthew.wahab@arm.com>
+	* gas/aarch64/reloc-insn.d: Likewise.
+
+2015-03-10  Matthew Wahab  <matthew.wahab@arm.com>
 
 	* gas/aarch64/codealign.d: Add test for code section alignment.
 	* gas/aarch64/codealign.s: New file.
diff --git a/gas/testsuite/gas/arm/dis-data.d b/gas/testsuite/gas/arm/dis-data.d
index 40ca770..c389763 100644
--- a/gas/testsuite/gas/arm/dis-data.d
+++ b/gas/testsuite/gas/arm/dis-data.d
@@ -5,6 +5,6 @@
 .*: +file format .*arm.*
 
 Disassembly of section \.text:
-0x00000000 20010000 	andcs	r0, r1, r0
-0x00000004 000000f9 	strdeq	r0, \[r0\], -r9
-0x00000008 00004cd5 	ldrdeq	r4, \[r0\], -r5
+00000000 <.text> 20010000 	.word	0x20010000
+00000004 <.text\+0x4> 000000f9 	.word	0x000000f9
+00000008 <.text\+0x8> 00004cd5 	.word	0x00004cd5
diff --git a/gas/testsuite/gas/arm/dis-data2.d b/gas/testsuite/gas/arm/dis-data2.d
index ef7bb81..9c50654 100644
--- a/gas/testsuite/gas/arm/dis-data2.d
+++ b/gas/testsuite/gas/arm/dis-data2.d
@@ -5,6 +5,6 @@
 .*: +file format .*arm.*
 
 Disassembly of section \.text:
-00000000 <main> 20010000 	andcs	r0, r1, r0
-00000004 <main\+0x4> 000000f9 	strdeq	r0, \[r0\], -r9
-00000008 <main\+0x8> 00004cd5 	ldrdeq	r4, \[r0\], -r5
+00000000 <main> 20010000 	.word	0x20010000
+00000004 <main\+0x4> 000000f9 	.word	0x000000f9
+00000008 <main\+0x8> 00004cd5 	.word	0x00004cd5


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