bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (ld) bfd_abs_section in .rodata, but modified


From: Nick Clifton
Subject: Re: (ld) bfd_abs_section in .rodata, but modified
Date: 16 Nov 2001 11:53:05 +0000
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/21.1

Hi Petr,

> When I try to link against some absolute file(h8300-coff) using
> --just-symbols=<absolute file>, ld crashes with segfault.

You did not provide a test case, so it is hard to be sure that the
patch below will fix this problem.

> It seems that  bfd_abs_section is defined const (and gcc puts it in
> .rodata), but coff_count_linenumbers tries to modify it.
> 
> Source (in cofgen.c):
>           {
>             /* This symbol has line numbers.  Increment the owning
>                section's linenumber count.  */
>             alent *l = q->lineno;
> 
> =>          ++q->symbol.section->output_section->lineno_count;
>             ++total;
>             ++l;

I think that this should fix the problem.  Please could you give it a
go and let me know.

Cheers
        Nick

2001-11-16  Nick Clifton  <address@hidden>

        * coffgen.c (coff_count_linenumbers): Check for the existence of
        an output section.

Index: bfd/coffgen.c
===================================================================
RCS file: /cvs/src/src/bfd/coffgen.c,v
retrieving revision 1.29
diff -p -r1.29 coffgen.c
*** coffgen.c   2001/11/02 16:29:15     1.29
--- coffgen.c   2001/11/16 11:52:04
*************** coff_count_linenumbers (abfd)
*** 555,569 ****
                 section's linenumber count.  */
              alent *l = q->lineno;
  
!             ++q->symbol.section->output_section->lineno_count;
!             ++total;
!             ++l;
!             while (l->line_number != 0)
                {
                  ++total;
-                 ++q->symbol.section->output_section->lineno_count;
                  ++l;
                }
            }
        }
      }
--- 555,570 ----
                 section's linenumber count.  */
              alent *l = q->lineno;
  
!             do
                {
+                 /* If the symbol came from an absolute input it
+                    will not have an output section associated with it.  */
+                 if (q->symbol.section->output_section)
+                   ++ q->symbol.section->output_section->lineno_count;
                  ++total;
                  ++l;
                }
+             while (l->line_number != 0);
            }
        }
      }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]