Define and use bfd_is_const_section().
authorNick Clifton <nickc@redhat.com>
Mon, 19 Nov 2001 15:35:38 +0000 (15:35 +0000)
committerNick Clifton <nickc@redhat.com>
Mon, 19 Nov 2001 15:35:38 +0000 (15:35 +0000)
bfd/ChangeLog
bfd/bfd-in2.h
bfd/coffgen.c
bfd/section.c

index 8e3b59b187f3b7649e7ecb6de90c6cefe30c08f1..b4d78291bcb5cbcb71910b00e28fb82abca69c86 100644 (file)
@@ -1,3 +1,11 @@
+2001-11-19  Nick Clifton  <nickc@cambridge.redhat.com>
+
+       * section.c (bfd_is_const_section): New macro.  Return true if the
+       given seciton is one of the special, constant, sections.
+       * bfd-in2.h: Regenerate.        
+       * coffgen.c (coff_count_linenumbers): Use bfd_is_const_section.
+       (coff_write_native_symbol): Use bfd_is_const_section.
+
 2001-11-19  Alan Modra  <amodra@bigpond.net.au>
 
        * elf32-hppa.c (clobber_millicode_symbols): Dec dynstr refcount.
 
        * mmo.c: Adjust documentation tags to use texinfo 4 features.
 
+2001-11-16  Nick Clifton  <nickc@cambridge.redhat.com>
+
+       * section.c (bfd_is_const_section): New macro.  Return true if the
+       section pointer refers to one of the special, constant sections.
+       * bfd-in2.h: Regenerate.
+
+       * coffgen.c (coff_count_linenumbers): Only update the line number
+       count in non-special sections.
+       (coff_write_native_symbol): Only update the line number file
+       position in non-special sections.
+
 2001-11-15  Daniel Jacobowitz  <drow@mvista.com>
 
        * elflink.h (elf_reloc_symbol_deleted_p): Catch all relocs against
index b99a3d4b34d6a279083296fc867f0e93063958f6..5f61853dc09e285ef5979b2f231b1fc1b6856e35 100644 (file)
@@ -1354,6 +1354,12 @@ extern const asection bfd_ind_section;
 #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;
index 3ce9f7849d02365ae2505cd4b784b0dd8d83b29a..513f635aa0c317b423d771991db48cea256d03dc 100644 (file)
@@ -555,15 +555,18 @@ coff_count_linenumbers (abfd)
                 section's linenumber count.  */
              alent *l = q->lineno;
 
-             ++q->symbol.section->output_section->lineno_count;
-             ++total;
-             ++l;
-             while (l->line_number != 0)
+             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;
-                 ++q->symbol.section->output_section->lineno_count;
                  ++l;
                }
+             while (l->line_number != 0);
            }
        }
     }
@@ -1145,8 +1148,9 @@ coff_write_native_symbol (abfd, symbol, written, string_size_p,
        }
       symbol->done_lineno = true;
 
-      symbol->symbol.section->output_section->moving_line_filepos +=
-       count * bfd_coff_linesz (abfd);
+      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 0d95f117834ec2db241fd3801ffa45349b714bf2..903f769c91301b33d7eb89e6ec7ea9e6f372cda7 100644 (file)
@@ -544,6 +544,12 @@ CODE_FRAGMENT
 .#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;
This page took 0.037272 seconds and 4 git commands to generate.