Skip to content

Commit 0db21b8

Browse files
committed
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. (cherry picked from commit 1f583bc)
1 parent fa15c41 commit 0db21b8

File tree

4 files changed

+38
-4
lines changed

4 files changed

+38
-4
lines changed

gas/ChangeLog

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
2021-01-26 H.J. Lu <hongjiu.lu@intel.com>
2+
3+
PR gas/27243
4+
* config/tc-nios2.c (md_begin): Don't disable relaxation with
5+
--gdwarf-N.
6+
* testsuite/gas/nios2/relax.d: New file.
7+
* testsuite/gas/nios2/relax.s: Likewise.
8+
19
2021-01-24 H.J. Lu <hongjiu.lu@intel.com>
210

311
PR gas/27228

gas/config/tc-nios2.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3643,10 +3643,6 @@ md_begin (void)
36433643
nios2_as_options.noat = FALSE;
36443644
nios2_as_options.nobreak = FALSE;
36453645

3646-
/* Debug information is incompatible with relaxation. */
3647-
if (debug_type != DEBUG_UNSPECIFIED)
3648-
nios2_as_options.relax = relax_none;
3649-
36503646
/* Initialize the alignment data. */
36513647
nios2_current_align_seg = now_seg;
36523648
nios2_last_label = NULL;

gas/testsuite/gas/nios2/relax.d

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#source: relax.s
2+
#as: --gdwarf-5
3+
#objdump: -w -WL -dr --prefix-addresses --show-raw-insn
4+
#name: NIOS2 relax with --gdwarf-5
5+
6+
# Test relaxation with assembler generated debug info.
7+
.*: file format elf32-littlenios2
8+
9+
Contents of the .debug_line section:
10+
11+
CU: ./relax.s:
12+
File +name +Line +number +Starting +address +View +Stmt
13+
relax.s +2 +0 +x
14+
relax.s +5 +0x10018 +x
15+
relax.s +- +0x1001c
16+
17+
Disassembly of section .text:
18+
0x00000000 21400526 beq r4,r5,0x00000018
19+
0x00000004 0002e03a nextpc at
20+
0x00000008 085fffc4 addi at,at,32767
21+
0x0000000c 085fffc4 addi at,at,32767
22+
0x00000010 08400484 addi at,at,18
23+
0x00000014 0800683a jmp at
24+
...
25+
0x00010018 f800283a ret

gas/testsuite/gas/nios2/relax.s

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.text
2+
bne r4, r5, 1f
3+
.zero 0x10000
4+
1:
5+
ret

0 commit comments

Comments
 (0)