public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Binutils <binutils@sourceware.org>
Cc: Sandra Loosemore <sandra@codesourcery.com>,
	Andrew Jenner <andrew@codesourcery.com>
Subject: [PATCH] nios2: Don't disable relaxation with --gdwarf-N
Date: Tue, 26 Jan 2021 04:51:42 -0800	[thread overview]
Message-ID: <CAMe9rOoUTX_-UWNhqYwcF3Cm4ETiUOgq7Te=i79VydxrPqGrtw@mail.gmail.com> (raw)
In-Reply-To: <20210125211919.123384-1-hjl.tools@gmail.com>

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

On Mon, Jan 25, 2021 at 1:19 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> After
>
> commit 705989f19adf20dd70c50237ec61cd708f2b0939
> Author: H.J. Lu <hjl.tools@gmail.com>
> Date:   Mon Jan 18 06:25:05 2021 -0800
>
>     as: Automatically enable DWARF5 support
>
> --gdwarf-5 is no longer needed to accept DWARF5 info generated by GCC.
>
> Since assembler generated debug information is incompatible with
> relaxation, don't generate debug information for assembly codes with
> --gdwarf-5 which is passed down by GCC.
>
> OK for master and 2.36 branch?
>
> H.J.
> ---
>         PR gas/27243
>         * config/tc-nios2.c (md_begin): Set debug_type to DEBUG_UNSPECIFIED
>         for --gdwarf-5.
>         * testsuite/gas/nios2/relax.d: New file.
>         * testsuite/gas/nios2/relax.s: Likewise.

GCC 11 passes --gdwarf-5 to assembler to enable DWARF5 debug info.  Don't
disable relaxation when --gdwarf-N is specified.  The assembler generated
debug information will treat the sequence of the relaxed instructions as
a single instruction.

OK for master and 2.36 branch?

-- 
H.J.

[-- Attachment #2: 0001-nios2-Don-t-disable-relaxation-with-gdwarf-N.patch --]
[-- Type: text/x-patch, Size: 2607 bytes --]

From d39a3002bdec4e71fa6f68b505c9cb0579821776 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Mon, 25 Jan 2021 13:14:34 -0800
Subject: [PATCH] nios2: Don't disable relaxation with --gdwarf-N

GCC 11 passes --gdwarf-5 to assembler to enable DWARF5 debug info.  Don't
disable relaxation when --gdwarf-N is specified.  The assembler generated
debug information will treat the sequence of the relaxed instructions as
a single instruction.

	PR gas/27243
	* config/tc-nios2.c (md_begin): Don't disable relaxation with
	--gdwarf-N.
	* testsuite/gas/nios2/relax.d: New file.
	* testsuite/gas/nios2/relax.s: Likewise.
---
 gas/config/tc-nios2.c           |  4 ----
 gas/testsuite/gas/nios2/relax.d | 25 +++++++++++++++++++++++++
 gas/testsuite/gas/nios2/relax.s |  5 +++++
 3 files changed, 30 insertions(+), 4 deletions(-)
 create mode 100644 gas/testsuite/gas/nios2/relax.d
 create mode 100644 gas/testsuite/gas/nios2/relax.s

diff --git a/gas/config/tc-nios2.c b/gas/config/tc-nios2.c
index eea6687fcc4..be4536caa8a 100644
--- a/gas/config/tc-nios2.c
+++ b/gas/config/tc-nios2.c
@@ -3643,10 +3643,6 @@ md_begin (void)
   nios2_as_options.noat = FALSE;
   nios2_as_options.nobreak = FALSE;
 
-  /* Debug information is incompatible with relaxation.  */
-  if (debug_type != DEBUG_UNSPECIFIED)
-    nios2_as_options.relax = relax_none;
-
   /* Initialize the alignment data.  */
   nios2_current_align_seg = now_seg;
   nios2_last_label = NULL;
diff --git a/gas/testsuite/gas/nios2/relax.d b/gas/testsuite/gas/nios2/relax.d
new file mode 100644
index 00000000000..ca01a4f926a
--- /dev/null
+++ b/gas/testsuite/gas/nios2/relax.d
@@ -0,0 +1,25 @@
+#source: relax.s
+#as: --gdwarf-5
+#objdump: -w -WL -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 relax with --gdwarf-5
+
+# Test relaxation with assembler generated debug info.
+.*:     file format elf32-littlenios2
+
+Contents of the .debug_line section:
+
+CU: ./relax.s:
+File +name +Line +number +Starting +address +View +Stmt
+relax.s +2 +0 +x
+relax.s +5 +0x10018 +x
+relax.s +- +0x1001c
+
+Disassembly of section .text:
+0x00000000 21400526 	beq	r4,r5,0x00000018
+0x00000004 0002e03a 	nextpc	at
+0x00000008 085fffc4 	addi	at,at,32767
+0x0000000c 085fffc4 	addi	at,at,32767
+0x00000010 08400484 	addi	at,at,18
+0x00000014 0800683a 	jmp	at
+	...
+0x00010018 f800283a 	ret
diff --git a/gas/testsuite/gas/nios2/relax.s b/gas/testsuite/gas/nios2/relax.s
new file mode 100644
index 00000000000..ef417fdc33b
--- /dev/null
+++ b/gas/testsuite/gas/nios2/relax.s
@@ -0,0 +1,5 @@
+	.text
+	bne	r4, r5, 1f
+	.zero 0x10000
+1:
+	ret
-- 
2.29.2


  reply	other threads:[~2021-01-26 12:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-25 21:19 [PATCH] nios2: Disable assembler debug info for --gdwarf-5 H.J. Lu
2021-01-26 12:51 ` H.J. Lu [this message]
2021-01-26 16:16   ` [PATCH] nios2: Don't disable relaxation with --gdwarf-N Sandra Loosemore

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='CAMe9rOoUTX_-UWNhqYwcF3Cm4ETiUOgq7Te=i79VydxrPqGrtw@mail.gmail.com' \
    --to=hjl.tools@gmail.com \
    --cc=andrew@codesourcery.com \
    --cc=binutils@sourceware.org \
    --cc=sandra@codesourcery.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).