]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[AArch64] Backport fix for minimum code section alignment
authorMatthew Wahab <matthew.wahab@arm.com>
Thu, 4 Jun 2015 10:16:56 +0000 (11:16 +0100)
committerJiong Wang <jiong.wang@arm.com>
Thu, 4 Jun 2015 10:16:56 +0000 (11:16 +0100)
gas/ChangeLog
gas/config/tc-aarch64.c
gas/testsuite/ChangeLog
gas/testsuite/gas/aarch64/codealign.d [new file with mode: 0644]
gas/testsuite/gas/aarch64/codealign.s [new file with mode: 0644]

index 7632ef836c032b9eac6a809a9b2f6399c9086cc1..1195d98d01e53cc778579890881851d729fc12f1 100644 (file)
@@ -1,3 +1,8 @@
+2015-06-04  Matthew Wahab  <matthew.wahab@arm.com>
+
+       * config/tc-aarch64.c (mapping_state): Set minimum alignment for code
+       sections.
+
 2015-05-07  Renlin Li  <renlin.li@arm.com>
 
        * config/tc-aarch64.c (s_aarch64_inst): Align frag during state
index 62a1a3fe2d95e3e9438bda85751496e3b91e61aa..10b1b740fa23ceb6d5cacdb63b32168fbb0062d7 100644 (file)
@@ -1481,7 +1481,14 @@ mapping_state (enum mstate state)
     /* The mapping symbol has already been emitted.
        There is nothing else to do.  */
     return;
-  else if (TRANSITION (MAP_UNDEFINED, MAP_DATA))
+
+  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 (TRANSITION (MAP_UNDEFINED, MAP_DATA))
     /* This case will be evaluated later in the next else.  */
     return;
   else if (TRANSITION (MAP_UNDEFINED, MAP_INSN))
index 01f74caa5fc431339b35a52b82552821ce62ab1a..6477054fcf325cc1358201dfc741fa100adfe248 100644 (file)
@@ -1,3 +1,8 @@
+2015-06-04  Matthew Wahab  <matthew.wahab@arm.com>
+
+       * gas/aarch64/codealign.d: Add test for code section alignment.
+       * gas/aarch64/codealign.s: New file.
+
 2015-05-14  Peter Bergner  <bergner@vnet.ibm.com>
 
        Applied from master.
diff --git a/gas/testsuite/gas/aarch64/codealign.d b/gas/testsuite/gas/aarch64/codealign.d
new file mode 100644 (file)
index 0000000..8e75c87
--- /dev/null
@@ -0,0 +1,16 @@
+#objdump: --section-headers 
+# Minimum code alignment should be set.
+# This test is only valid on ELF based ports.
+#not-target: *-*-*coff *-*-pe *-*-wince *-*-*aout* *-*-netbsd *-*-riscix*
+
+.*: +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.s b/gas/testsuite/gas/aarch64/codealign.s
new file mode 100644 (file)
index 0000000..b80a6d9
--- /dev/null
@@ -0,0 +1,2 @@
+.text
+  nop