aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2021-01-26 08:18:39 -0800
committerH.J. Lu <hjl.tools@gmail.com>2021-01-26 08:18:52 -0800
commit1f583bc2fcb1b5c4125faf8b8e815255b2b21b62 (patch)
tree3edf29303405b2e9a25fc8766a08a2b68733705f /gas
parent4ef367bffd73d50002339deba40983530ccb9d15 (diff)
downloadbinutils-1f583bc2fcb1b5c4125faf8b8e815255b2b21b62.zip
binutils-1f583bc2fcb1b5c4125faf8b8e815255b2b21b62.tar.gz
binutils-1f583bc2fcb1b5c4125faf8b8e815255b2b21b62.tar.bz2
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.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog8
-rw-r--r--gas/config/tc-nios2.c4
-rw-r--r--gas/testsuite/gas/nios2/relax.d25
-rw-r--r--gas/testsuite/gas/nios2/relax.s5
4 files changed, 38 insertions, 4 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index e76a5bf..b3eb7db 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,11 @@
+2021-01-26 H.J. Lu <hongjiu.lu@intel.com>
+
+ 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.
+
2021-01-26 Alan Modra <amodra@gmail.com>
* testsuite/gas/all/local-label-overflow.d: Use xfail rather than
diff --git a/gas/config/tc-nios2.c b/gas/config/tc-nios2.c
index eea6687..be4536c 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 0000000..ca01a4f
--- /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 0000000..ef417fd
--- /dev/null
+++ b/gas/testsuite/gas/nios2/relax.s
@@ -0,0 +1,5 @@
+ .text
+ bne r4, r5, 1f
+ .zero 0x10000
+1:
+ ret