summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog19
-rw-r--r--bfd/bfd-in2.h6
-rw-r--r--bfd/coffgen.c18
-rw-r--r--bfd/section.c6
4 files changed, 42 insertions, 7 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 8e3b59b187f..b4d78291bcb 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -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.
@@ -14,6 +22,17 @@
* 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
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index b99a3d4b34d..5f61853dc09 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -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;
diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index 3ce9f7849d0..513f635aa0c 100644
--- a/bfd/coffgen.c
+++ b/bfd/coffgen.c
@@ -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,
diff --git a/bfd/section.c b/bfd/section.c
index 0d95f117834..903f769c913 100644
--- a/bfd/section.c
+++ b/bfd/section.c
@@ -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;