public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [backport][2.25][aarch64]Don't create new frag for .inst directive when certain conditions fullfil
@ 2015-05-06 14:15 Renlin Li
  2015-05-07  8:03 ` Marcus Shawcroft
  0 siblings, 1 reply; 2+ messages in thread
From: Renlin Li @ 2015-05-06 14:15 UTC (permalink / raw)
  To: binutils; +Cc: Marcus Shawcroft, Nicholas Clifton

[-- Attachment #1: Type: text/plain, Size: 617 bytes --]

Hi all,

This is a backport patch from the trunk introduced here: 
https://sourceware.org/ml/binutils/2015-03/msg00389.html

After the change, new frag is created for .inst directive, only during 
state transition in executable section. The same rule applies when 
handling normal instructions.

binutils, gas, ld regresstion test Okay.
Okay to commit?

Regards,
Renlin Li

Backport from mainline

2015-05-06  Renlin Li  <renlin.li@arm.com>

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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: tmp.diff --]
[-- Type: text/x-patch; name=tmp.diff, Size: 1365 bytes --]

diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c
index ce2ba95..62a1a3f 100644
--- a/gas/config/tc-aarch64.c
+++ b/gas/config/tc-aarch64.c
@@ -1863,8 +1863,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
@@ -5571,6 +5577,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;

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-05-07  8:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-06 14:15 [backport][2.25][aarch64]Don't create new frag for .inst directive when certain conditions fullfil Renlin Li
2015-05-07  8:03 ` Marcus Shawcroft

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).