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 16:43:27 +0000
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/21.1

Hi Petr,

> > Would it be possible for you to send me copies of t1.s and t2.s ?
> They are in attachment ...

Thanks.  I can now reproduce the problem, and here is a patch to take
care of it.  (I hope!)  After applying the patch you will need to go
into the bfd build directory and run "make headers" before going to
the top level and using "make all-ld" to rebuild the linker.

Let me know how you get on.

Cheers
        Nick

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 16:42:06
*************** 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,572 ----
                 section's linenumber count.  */
              alent *l = q->lineno;
  
!             do
                {
+                 asection * sec = q->symbol.section->output_section;
+                 
+                 /* Do not try to update fields in read-only sections.  */
+                 if (! bfd_is_const_section (sec))
+                   sec->lineno_count ++;
+ 
                  ++total;
                  ++l;
                }
+             while (l->line_number != 0);
            }
        }
      }
*************** coff_write_native_symbol (abfd, symbol, 
*** 1145,1152 ****
        }
        symbol->done_lineno = true;
  
!       symbol->symbol.section->output_section->moving_line_filepos +=
!       count * bfd_coff_linesz (abfd);
      }
  
    return coff_write_symbol (abfd, &(symbol->symbol), native, written,
--- 1148,1156 ----
        }
        symbol->done_lineno = true;
  
!       if (! bfd_is_const_section (symbol->symbol.section->output_section))
!       symbol->symbol.section->output_section->moving_line_filepos +=
!         count * bfd_coff_linesz (abfd);
      }
  
    return coff_write_symbol (abfd, &(symbol->symbol), native, written,

Index: bfd/section.c
===================================================================
RCS file: /cvs/src/src/bfd/section.c,v
retrieving revision 1.40
diff -p -r1.40 section.c
*** section.c   2001/11/13 03:52:25     1.40
--- section.c   2001/11/16 16:42:06
*************** CODE_FRAGMENT
*** 544,549 ****
--- 544,555 ----
  .#define bfd_ind_section_ptr ((asection *) &bfd_ind_section)
  .#define bfd_is_ind_section(sec) ((sec) == bfd_ind_section_ptr)
  .
+ .#define bfd_is_const_section(SEC)            \
+ . (   ((SEC) == bfd_abs_section_ptr)          \
+ .  || ((SEC) == bfd_und_section_ptr)          \
+ .  || ((SEC) == bfd_com_section_ptr)          \
+ .  || ((SEC) == bfd_ind_section_ptr))
+ .
  .extern const struct symbol_cache_entry * const bfd_abs_symbol;
  .extern const struct symbol_cache_entry * const bfd_com_symbol;
  .extern const struct symbol_cache_entry * const bfd_und_symbol;




reply via email to

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