This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [PATCH] fix as segv on alpha when --gdwarf2 is used
- From: Richard Henderson <rth at redhat dot com>
- To: Julien LEMOINE <speedblue at debian dot org>
- Cc: binutils at sources dot redhat dot com
- Date: Mon, 21 Apr 2003 11:23:42 -0700
- Subject: Re: [PATCH] fix as segv on alpha when --gdwarf2 is used
- References: <20030418234703.GE4912@trinity.all-3rd.net>
On Sat, Apr 19, 2003 at 01:47:03AM +0200, Julien LEMOINE wrote:
> Fix the segv on alpha when try to assemble test.s
> % cat /tmp/test.s
> .file 2 "axp.s"
> .ent qt_vstart
> jsr $26,qt_error
> .end qt_vstart
> % as --gdwarf2 foo.s
> zsh: segmentation fault (core dumped) as --gdwarf2 foo.s
Your patch is not quite correct, since the source itself is
in error. A correct fix yields:
z.s: Assembler messages:
z.s:4: Error: unassigned file number 1
r~
* dwarf2dbg.c (get_filenum): Skip as-yet unassigned file numbers.
(out_file_list): Assign non-null filename after generating error.
Index: dwarf2dbg.c
===================================================================
RCS file: /cvs/src/src/gas/dwarf2dbg.c,v
retrieving revision 1.61
diff -c -p -d -u -r1.61 dwarf2dbg.c
--- dwarf2dbg.c 11 Mar 2003 22:00:33 -0000 1.61
+++ dwarf2dbg.c 21 Apr 2003 18:20:18 -0000
@@ -411,6 +411,7 @@ get_filenum (filename, num)
{
for (i = 1; i < files_in_use; ++i)
if (files[i].dir == dir
+ && files[i].filename
&& strcmp (file, files[i].filename) == 0)
{
last_used = i;
@@ -1089,6 +1090,8 @@ out_file_list ()
if (files[i].filename == NULL)
{
as_bad (_("unassigned file number %ld"), (long) i);
+ /* Prevent a crash later, particularly for file 1. */
+ files[i].filename = "";
continue;
}