public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Renlin Li <renlin.li@arm.com>
To: "binutils@sourceware.org" <binutils@sourceware.org>
Cc: Nicholas Clifton <nickc@redhat.com>,
	 Marcus Shawcroft <Marcus.Shawcroft@arm.com>
Subject: [2.25][AARCH64][GAS]Backport "Positively emit symbols for alignment."
Date: Wed, 17 Jun 2015 09:39:00 -0000	[thread overview]
Message-ID: <55814031.2010000@arm.com> (raw)
In-Reply-To: <553A3CAD.3050208@arm.com>

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

Hi all,

This is a backport patch from the discussion here:

https://sourceware.org/ml/binutils/2015-05/msg00027.html
https://sourceware.org/ml/binutils/2015-05/msg00027.html

The expected results of testcases are modified to account the status of 
binutils 2.25.

Binutils, ld, gas regression test Okay. Okay to commit for branch 2.25?


Regards,
Renlin Li


gas/ChangeLog:

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

         Backport from mainline.
         2015-05-05  Renlin Li  <renlin.li@arm.com>

         * config/tc-aarch64.c (aarch64_init_frag): Always generate 
mapping symbols.

gas/testsuite/ChangeLog:

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

         Backport from mainline.
         2015-05-05  Renlin Li  <renlin.li@arm.com>

         * gas/aarch64/mapping_5.d: New.
         * gas/aarch64/mapping_5.s: New.
         * gas/aarch64/mapping_6.d: New.
         * gas/aarch64/mapping_6.s: New.


On 24/04/15 13:53, Renlin Li wrote:
> Hi all,
>
> In arm_init_frag(), when ARM or THUMB are recorded,  it will simply 
> return without doing anything. This is not correct in a few cases.
>
> For the following two cases:
> case 1:
>         nop        ----> MAP_ARM
>         .long   0 ---> MAP_DATA
>         .align  4 --->
>                       ---->(1)
>                       ----> start new frag
>         .word   0x12345678
>
> (1) paddings here are all treated as data, because the previous state 
> is MAP_DATA.
>
> case 2:
>         nop       ----> MAP_ARM
>         .long   0 ---> MAP_DATA
>         .byte   1
>         .align  2 ---> (1)
>                      ----> (2)
>                      ----> start new frag
>         .long   0x12345678 ----> (3)
>
> stage 1: while parsing the input file:
> (1) arm_init_frag early returns, No state change, no new symbol. (3)No 
> state change, no new symbol.
> stage 2: Later, while writing the object file:
> (2)MAP_DATA, MAP_ARM are inserted by insert_data_mapping_symol to 
> handle alignment. (3) interpreted as instruction because of the 
> MAP_ARM inserted at (2)
>
>
> This change might generate redundant symbols, some of them can be 
> removed later. In check_mapping_symbols(), the symbols at the end of a 
> section, and overlapping symbols will be removed.
>
> gas checked without any new issues. Okay to commit?
>
> By the way, Nick, aarch64 has the same issue. The same can be done to 
> aarch64_init_frag(). Another way is to remove 
> fragP->tc_frag_data.recorded. It's only used in a few places. But I am 
> sure what dose it intended to do, Could you please explain a little 
> bit for me?
>
> Regards,
> Renlin Li
>
>
> gas/ChangeLog:
>
> 2015-04-24  Renlin Li  <renlin.li@arm.com>
>
>     * config/tc-arm.c (arm_init_frag): Always emit mapping symbols.
>
> gas/testsuite/ChangeLog:
>
> 2015-04-24  Renlin Li  <renlin.li@arm.com>
>
>     * gas/arm/thumb2_vpool_be.d: Adjust the desired output.
>     * gas/arm/vldconst_be.d: Ditto.
>


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

commit 262a89bcf8dd349e065d46896965c49054c8a034
Author: Renlin Li <renlin.li@arm.com>
Date:   Wed Jun 3 16:34:10 2015 +0100

    aarch64 backport
    
    Change-Id: Ie8d550c3518a25de0094fe7dc7bcfecd1ac77356

diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c
index 62a1a3f..015b0b7 100644
--- a/gas/config/tc-aarch64.c
+++ b/gas/config/tc-aarch64.c
@@ -5914,21 +5914,20 @@ aarch64_init_frag (fragS * fragP, int max_chars)
   /* Record a mapping symbol for alignment frags.  We will delete this
      later if the alignment ends up empty.  */
   if (!fragP->tc_frag_data.recorded)
+    fragP->tc_frag_data.recorded = 1;
+
+  switch (fragP->fr_type)
     {
-      fragP->tc_frag_data.recorded = 1;
-      switch (fragP->fr_type)
-	{
-	case rs_align:
-	case rs_align_test:
-	case rs_fill:
-	  mapping_state_2 (MAP_DATA, max_chars);
-	  break;
-	case rs_align_code:
-	  mapping_state_2 (MAP_INSN, max_chars);
-	  break;
-	default:
-	  break;
-	}
+    case rs_align:
+    case rs_align_test:
+    case rs_fill:
+      mapping_state_2 (MAP_DATA, max_chars);
+      break;
+    case rs_align_code:
+      mapping_state_2 (MAP_INSN, max_chars);
+      break;
+    default:
+      break;
     }
 }
 \f
diff --git a/gas/testsuite/gas/aarch64/mapping_5.d b/gas/testsuite/gas/aarch64/mapping_5.d
new file mode 100644
index 0000000..8a85038
--- /dev/null
+++ b/gas/testsuite/gas/aarch64/mapping_5.d
@@ -0,0 +1,14 @@
+#objdump: --syms --special-syms
+#name: AArch64 Mapping Symbols Test 5
+
+.*: +file format.*aarch64.*
+
+SYMBOL TABLE:
+[0]+00 l    d  .text	[0]+00 .text
+[0]+00 l    d  .data	[0]+00 .data
+[0]+00 l    d  .bss	[0]+00 .bss
+[0]+00 l       .text	[0]+00 \$x
+[0]+04 l       .text	[0]+00 \$d
+[0]+08 l       .text	[0]+00 \$x
+[0]+10 l       .text	[0]+00 \$d
+[0]+14 l       .text	[0]+00 \$x
diff --git a/gas/testsuite/gas/aarch64/mapping_5.s b/gas/testsuite/gas/aarch64/mapping_5.s
new file mode 100644
index 0000000..2cb95ed
--- /dev/null
+++ b/gas/testsuite/gas/aarch64/mapping_5.s
@@ -0,0 +1,5 @@
+	.text
+	nop
+	.long	0
+	.align	4
+	.word	0x12345678
diff --git a/gas/testsuite/gas/aarch64/mapping_6.d b/gas/testsuite/gas/aarch64/mapping_6.d
new file mode 100644
index 0000000..df6bdaa
--- /dev/null
+++ b/gas/testsuite/gas/aarch64/mapping_6.d
@@ -0,0 +1,15 @@
+#objdump: --syms --special-syms
+#name: AArch64 Mapping Symbols Test 6
+
+.*: +file format.*aarch64.*
+
+SYMBOL TABLE:
+[0]+00 l    d  .text	[0]+00 .text
+[0]+00 l    d  .data	[0]+00 .data
+[0]+00 l    d  .bss	[0]+00 .bss
+[0]+00 l       .text	[0]+00 \$x
+[0]+04 l       .text	[0]+00 \$d
+[0]+10 l       .text	[0]+00 \$d
+[0]+14 l       .text	[0]+00 \$x
+[0]+09 l       .text	[0]+00 \$d
+[0]+0c l       .text	[0]+00 \$x
diff --git a/gas/testsuite/gas/aarch64/mapping_6.s b/gas/testsuite/gas/aarch64/mapping_6.s
new file mode 100644
index 0000000..4e0e2c5
--- /dev/null
+++ b/gas/testsuite/gas/aarch64/mapping_6.s
@@ -0,0 +1,6 @@
+	.text
+	nop
+	.long	0
+	.byte	1
+	.align	4
+	.word	0x12345678

  parent reply	other threads:[~2015-06-17  9:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-24 12:53 [GAS][ARM]Positively emit symbols for alignment Renlin Li
2015-04-24 16:40 ` Nicholas Clifton
2015-05-05 15:22   ` Commit: [GAS][AARCH64]Positively " Renlin Li
2015-04-28 21:07 ` [GAS][ARM]Positively " Hans-Peter Nilsson
2015-04-29  9:21   ` [GAS][ARM]Positively emit symbols for alignment. --> [PATCH][LD][ARM] Fix two test case failures Renlin Li
2015-04-29  9:23     ` Richard Earnshaw
2015-06-16  8:24 ` [2.25][ARM][GAS]Backport "Positively emit symbols for alignment." Renlin Li
2015-06-16  8:29   ` Tristan Gingold
2015-06-16  8:31   ` Renlin Li
2015-06-17  9:39 ` Renlin Li [this message]
2015-06-17 10:20   ` [2.25][AARCH64][GAS]Backport " Tristan Gingold

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55814031.2010000@arm.com \
    --to=renlin.li@arm.com \
    --cc=Marcus.Shawcroft@arm.com \
    --cc=binutils@sourceware.org \
    --cc=nickc@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).