Ignore sections with zero size.

This commit is contained in:
Nick Clifton 2000-12-12 22:54:39 +00:00
parent 7ec229cebe
commit 3a71aec8b4
2 changed files with 11 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2000-12-08 Mark Salter <msalter@redhat.com>
* binary.c (binary_set_section_contents): Ignore sections
with zero size.
2000-12-12 Kazu Hirata <kazu@hxi.com> 2000-12-12 Kazu Hirata <kazu@hxi.com>
* m68klinux.c: Fix formatting. * m68klinux.c: Fix formatting.

View File

@ -255,6 +255,9 @@ binary_set_section_contents (abfd, sec, data, offset, size)
file_ptr offset; file_ptr offset;
bfd_size_type size; bfd_size_type size;
{ {
if (size == 0)
return true;
if (! abfd->output_has_begun) if (! abfd->output_has_begun)
{ {
boolean found_low; boolean found_low;
@ -270,6 +273,7 @@ binary_set_section_contents (abfd, sec, data, offset, size)
if (((s->flags if (((s->flags
& (SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC | SEC_NEVER_LOAD)) & (SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC | SEC_NEVER_LOAD))
== (SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC)) == (SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC))
&& (s->_raw_size > 0)
&& (! found_low || s->lma < low)) && (! found_low || s->lma < low))
{ {
low = s->lma; low = s->lma;
@ -284,7 +288,8 @@ binary_set_section_contents (abfd, sec, data, offset, size)
occupy file space. */ occupy file space. */
if ((s->flags if ((s->flags
& (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_NEVER_LOAD)) & (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_NEVER_LOAD))
!= (SEC_HAS_CONTENTS | SEC_ALLOC)) != (SEC_HAS_CONTENTS | SEC_ALLOC)
|| (s->_raw_size == 0))
continue; continue;
/* If attempting to generate a binary file from a bfd with /* If attempting to generate a binary file from a bfd with