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] [AArch64] Record instruction alignment for .inst directive


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

commit 448eb63d72d960524ffe169f08419daf590b86d7
Author: Renlin Li <renlin.li@arm.com>
Date:   Wed May 6 12:18:19 2015 +0100

    [AArch64] Record instruction alignment for .inst directive
    
    2015-05-06  Renlin Li  <renlin.li@arm.com>
    
      gas/
        * config/tc-aarch64.c (mapping_state): Recording alignment before exit.
    
      gas/testsuite/
        * gas/aarch64/codealign_1.s: New.
        * gas/aarch64/codealign_1.d: New.

Diff:
---
 gas/ChangeLog                           |  4 ++++
 gas/config/tc-aarch64.c                 | 10 +++++-----
 gas/testsuite/ChangeLog                 |  5 +++++
 gas/testsuite/gas/aarch64/codealign_1.d | 13 +++++++++++++
 gas/testsuite/gas/aarch64/codealign_1.s |  3 +++
 5 files changed, 30 insertions(+), 5 deletions(-)

diff --git a/gas/ChangeLog b/gas/ChangeLog
index c873270..3d2feb9 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,7 @@
+2015-05-06  Renlin Li  <renlin.li@arm.com>
+
+	* config/tc-aarch64.c (mapping_state): Recording alignment before exit.
+
 2015-05-05  Renlin Li  <renlin.li@arm.com>
 
 	* config/tc-aarch64.c (aarch64_init_frag): Always generate mapping
diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c
index 12012de..ae0e2d6 100644
--- a/gas/config/tc-aarch64.c
+++ b/gas/config/tc-aarch64.c
@@ -1460,17 +1460,17 @@ mapping_state (enum mstate state)
 {
   enum mstate mapstate = seg_info (now_seg)->tc_segment_info_data.mapstate;
 
-  if (mapstate == state)
-    /* The mapping symbol has already been emitted.
-       There is nothing else to do.  */
-    return;
-
   if (state == MAP_INSN)
     /* AArch64 instructions require 4-byte alignment.  When emitting
        instructions into any section, record the appropriate section
        alignment.  */
     record_alignment (now_seg, 2);
 
+  if (mapstate == state)
+    /* The mapping symbol has already been emitted.
+       There is nothing else to do.  */
+    return;
+
 #define TRANSITION(from, to) (mapstate == (from) && state == (to))
   if (TRANSITION (MAP_UNDEFINED, MAP_DATA) && !subseg_text_p (now_seg))
     /* Emit MAP_DATA within executable section in order.  Otherwise, it will be
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index 29649e1..41604ef 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2015-05-06  Renlin Li  <renlin.li@arm.com>
+
+	* gas/aarch64/codealign_1.s: New.
+	* gas/aarch64/codealign_1.d: New.
+
 2015-05-05  Renlin Li  <renlin.li@arm.com>
 
 	* gas/aarch64/mapping_5.d: New.
diff --git a/gas/testsuite/gas/aarch64/codealign_1.d b/gas/testsuite/gas/aarch64/codealign_1.d
new file mode 100644
index 0000000..08f4c25
--- /dev/null
+++ b/gas/testsuite/gas/aarch64/codealign_1.d
@@ -0,0 +1,13 @@
+#objdump: --section-headers
+# Minimum code alignment should be set.
+
+.*: +file format.*aarch64.*
+
+Sections:
+Idx Name          Size      VMA               LMA               File off  Algn
+  0 \.text         .*  .*  .*  .*  2\*\*2
+                  .*CODE.*
+  1 \.data         .*  .*  .* .*  2\*\*0
+                  .*DATA.*
+  2 \.bss          .*  .*  .*  .*  2\*\*0
+.*
diff --git a/gas/testsuite/gas/aarch64/codealign_1.s b/gas/testsuite/gas/aarch64/codealign_1.s
new file mode 100644
index 0000000..b27cc6b
--- /dev/null
+++ b/gas/testsuite/gas/aarch64/codealign_1.s
@@ -0,0 +1,3 @@
+.text
+  .byte 0xf
+  .inst 0xd503201f


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