summaryrefslogtreecommitdiffstats
path: root/contrib/binutils/bfd/binary.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/binutils/bfd/binary.c')
-rw-r--r--contrib/binutils/bfd/binary.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/contrib/binutils/bfd/binary.c b/contrib/binutils/bfd/binary.c
index c2980b0..771e431 100644
--- a/contrib/binutils/bfd/binary.c
+++ b/contrib/binutils/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;
@@ -281,17 +285,18 @@ binary_set_section_contents (abfd, sec, data, offset, size)
s->filepos = s->lma - low;
/* Skip following warning check for sections that will not
- occupy file space. */
+ 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
LMA's all over the place, huge (sparse?) binary files may
result. This condition attempts to detect this situation
and print a warning. Better heuristics would be nice to
- have. */
+ have. */
if (s->filepos < 0)
(*_bfd_error_handler)
@@ -383,6 +388,6 @@ const bfd_target binary_vec =
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
NULL,
-
+
NULL
};
OpenPOWER on IntegriCloud