summaryrefslogtreecommitdiff
path: root/bfd/format.c
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2005-05-17 19:44:55 +0000
committerDaniel Jacobowitz <drow@false.org>2005-05-17 19:44:55 +0000
commit26ae6d5ed03b3e749598b33ffd0aaefbaf9a6d7d (patch)
treea2a86631e13f89e100ac36db20db4170c9610924 /bfd/format.c
parent970c3dbce892feccbd6334ebc431a82b84934efd (diff)
* elf.c (_bfd_elf_write_object_contents): Check for non-NULL
elf_shstrtab. * format.c (bfd_check_format_matches): Set output_has_begun for both_direction. * section.c (bfd_set_section_contents): Use bfd_write_p. Remove special case for both_direction.
Diffstat (limited to 'bfd/format.c')
-rw-r--r--bfd/format.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/bfd/format.c b/bfd/format.c
index 3a36210cf0..4ccca2a3aa 100644
--- a/bfd/format.c
+++ b/bfd/format.c
@@ -173,6 +173,14 @@ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching)
if (matching)
free (matching_vector);
+ /* If the file was opened for update, then `output_has_begun'
+ some time ago when the file was created. Do not recompute
+ sections sizes or alignments in _bfd_set_section_contents.
+ We can not set this flag until after checking the format,
+ because it will interfere with creation of BFD sections. */
+ if (abfd->direction == both_direction)
+ abfd->output_has_begun = TRUE;
+
return TRUE; /* File position has moved, BTW. */
}
@@ -319,6 +327,14 @@ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching)
if (matching)
free (matching_vector);
+ /* If the file was opened for update, then `output_has_begun'
+ some time ago when the file was created. Do not recompute
+ sections sizes or alignments in _bfd_set_section_contents.
+ We can not set this flag until after checking the format,
+ because it will interfere with creation of BFD sections. */
+ if (abfd->direction == both_direction)
+ abfd->output_has_begun = TRUE;
+
return TRUE; /* File position has moved, BTW. */
}