From 3a71aec8b4c34df68c74c4869c47a109ca7bcfb6 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Tue, 12 Dec 2000 22:54:39 +0000 Subject: [PATCH] Ignore sections with zero size. --- bfd/ChangeLog | 5 +++++ bfd/binary.c | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index f9a087b3f37..ed0fb41c318 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2000-12-08 Mark Salter + + * binary.c (binary_set_section_contents): Ignore sections + with zero size. + 2000-12-12 Kazu Hirata * m68klinux.c: Fix formatting. diff --git a/bfd/binary.c b/bfd/binary.c index fd68a8eaeba..771e4312f73 100644 --- a/bfd/binary.c +++ b/bfd/binary.c @@ -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 -- 2.30.2