https://sourceware.org/bugzilla/show_bug.cgi?id=33229

            Bug ID: 33229
           Summary: [2.45/2.46 regression] nds32 gas segfaults on gcc
                    output
           Product: binutils
           Version: 2.46 (HEAD)
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gas
          Assignee: unassigned at sourceware dot org
          Reporter: mikpelinux at gmail dot com
  Target Milestone: ---

Created attachment 16208
  --> https://sourceware.org/bugzilla/attachment.cgi?id=16208&action=edit
test case

The following source file (also attached) causes gas for
nds32le-unknown-linux-gnu to segfault:

> cat /tmp/crtbegin.s
        .text
        .align  2
        .type   __do_global_dtors_aux, @function
__do_global_dtors_aux:
        .relax_hint 0
        lbi     $r0, [$r6 + lo12(completed.0)]
        bal     deregister_tm_clones
        ret5
> gas/as-new --version
GNU assembler (GNU Binutils) 2.45.50.20250729
Copyright (C) 2025 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `nds32le-unknown-linux-gnu'.
> gdb gas/as-new
GNU gdb (Fedora Linux) 16.3-1.fc41
Copyright (C) 2024 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from gas/as-new...
(gdb) run /tmp/crtbegin.s
Starting program: /tmp/objdir/gas/as-new /tmp/crtbegin.s

This GDB supports auto-downloading debuginfo from the following URLs:
  <https://debuginfod.fedoraproject.org/>
Enable debuginfod for this session? (y or [n]) y
Debuginfod has been enabled.
To make this setting permanent, add 'set debuginfod enabled on' to .gdbinit.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x000000000042e124 in nds32_find_reloc_table (relocs_pattern=<optimized out>,
hint_info=0x7fffffffd510) at /tmp/binutils-gdb.git/gas/config/tc-nds32.c:5682
5682          if (pattern->opcode->isize == 4)
(gdb) print pattern->opcode
$1 = (struct nds32_opcode *) 0x0

The test case is derived from gcc-12.5.0's crtbegin.o (later gcc versions have
other issues).

This worked with binutils-2.44 and earlier, but broke in binutils-2.45 and is
still broken in current HEAD of master. A git bisect identified

# first new commit: [1ac26e9f7ac250cd63f766eae0facea3485b16e4] nds32: use
is_whitespace()

as the culprit.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to