]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[AArch64][Backport] Don't always create new frag for .inst directive
authorRenlin Li <renlin.li@arm.com>
Thu, 7 May 2015 10:47:53 +0000 (11:47 +0100)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Thu, 24 Aug 2017 12:47:00 +0000 (09:47 -0300)
  2015-05-06  Renlin Li  <renlin.li@arm.com>

  Backport from mainline
  gas/
    * config/tc-aarch64.c (s_aarch64_inst): Align frag during state
    transition within executable section.
    (md_assemble): Likewise.

gas/ChangeLog
gas/config/tc-aarch64.c

index 300833a8e63c344e2123573d28859916d453ef84..7632ef836c032b9eac6a809a9b2f6399c9086cc1 100644 (file)
@@ -1,3 +1,9 @@
+2015-05-07  Renlin Li  <renlin.li@arm.com>
+
+       * config/tc-aarch64.c (s_aarch64_inst): Align frag during state
+       transition within executable section.
+       (md_assemble): Likewise.
+
 2015-04-06  Evandro Menezes  <e.menezes@samsung.com>
 
        * config/tc-aarch64.c: Add support for Samsung Exynos M1.
index bc5f7dd9a2f5b3add7d8b261d81f0f73931f5bb0..893abd7c2a6c9b1c2284cc9578a5d505f772242a 100644 (file)
@@ -1864,8 +1864,14 @@ s_aarch64_inst (int ignored ATTRIBUTE_UNUSED)
       return;
     }
 
-  if (!need_pass_2)
+  /* Sections are assumed to start aligned. In text section, there is no
+     MAP_DATA symbol pending. So we only align the address during
+     MAP_DATA --> MAP_INSN transition.
+     For other sections, this is not guaranteed.  */
+  enum mstate mapstate = seg_info (now_seg)->tc_segment_info_data.mapstate;
+  if (!need_pass_2 && (subseg_text_p (now_seg) && mapstate == MAP_DATA))
     frag_align_code (2, 0);
+
 #ifdef OBJ_ELF
   mapping_state (MAP_INSN);
 #endif
@@ -5630,6 +5636,14 @@ md_assemble (char *str)
 
   init_operand_error_report ();
 
+  /* Sections are assumed to start aligned. In text section, there is no
+     MAP_DATA symbol pending. So we only align the address during
+     MAP_DATA --> MAP_INSN transition.
+     For other sections, this is not guaranteed.  */
+  enum mstate mapstate = seg_info (now_seg)->tc_segment_info_data.mapstate;
+  if (!need_pass_2 && (subseg_text_p (now_seg) && mapstate == MAP_DATA))
+    frag_align_code (2, 0);
+
   saved_cond = inst.cond;
   reset_aarch64_instruction (&inst);
   inst.cond = saved_cond;