[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Segmentation fault in as
From: |
Nick Clifton |
Subject: |
Re: Segmentation fault in as |
Date: |
25 Apr 2001 11:05:49 +0100 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 |
Hi Stefan,
> This seems to afflict all coff targets, not just m68k.
[Except for arm-coff for some reason!]
> The problem seems to be that a line number of zero is treated in
> some ghastly special way by do_linenos_for(). See about line 3353
> of gas/config/obj-coff.c.
Yup, a line number if zero is used to indicate the start of a new
file. The code expects the find a filename stored in the l_symndx
field, which is why the abort occurs. Adding a simple test to see if
the field has been initialised prevents the seg fault.
Cheers
Nick
PS. The first part of the patch is just to fix a compile time warning
message.
2001-04-25 Nick Clifton <address@hidden>
* config/obj-coff.c (do_linenos_for): Check to see if the filename
symbol has been initialised before extracting its symbol index.
Index: gas/config/obj-coff.c
===================================================================
RCS file: /cvs/src/src/gas/config/obj-coff.c,v
retrieving revision 1.43
diff -p -r1.43 obj-coff.c
*** obj-coff.c 2001/03/30 07:07:10 1.43
--- obj-coff.c 2001/04/25 09:03:00
*************** fill_section (abfd, h, file_cursor)
*** 2076,2082 ****
if (s->s_name[0])
{
fragS *frag = segment_info[i].frchainP->frch_root;
! char *buffer;
if (s->s_size == 0)
s->s_scnptr = 0;
--- 2076,2082 ----
if (s->s_name[0])
{
fragS *frag = segment_info[i].frchainP->frch_root;
! char *buffer = NULL;
if (s->s_size == 0)
s->s_scnptr = 0;
*************** do_linenos_for (abfd, h, file_cursor)
*** 3350,3361 ****
line_ptr != (struct lineno_list *) NULL;
line_ptr = line_ptr->next)
{
-
if (line_ptr->line.l_lnno == 0)
{
! /* Turn a pointer to a symbol into the symbols' index */
! line_ptr->line.l_addr.l_symndx =
! ((symbolS *) line_ptr->line.l_addr.l_symndx)->sy_number;
}
else
{
--- 3351,3363 ----
line_ptr != (struct lineno_list *) NULL;
line_ptr = line_ptr->next)
{
if (line_ptr->line.l_lnno == 0)
{
! /* Turn a pointer to a symbol into the symbols' index,
! provided that it has been initialised. */
! if (line_ptr->line.l_addr.l_symndx)
! line_ptr->line.l_addr.l_symndx =
! ((symbolS *) line_ptr->line.l_addr.l_symndx)->sy_number;
}
else
{