Ignore sections with zero size.
authorNick Clifton <nickc@redhat.com>
Tue, 12 Dec 2000 22:54:39 +0000 (22:54 +0000)
committerNick Clifton <nickc@redhat.com>
Tue, 12 Dec 2000 22:54:39 +0000 (22:54 +0000)
bfd/ChangeLog
bfd/binary.c

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