diff options
author | David E. O'Brien <obrien@FreeBSD.org> | 2001-05-28 05:21:37 +0000 |
---|---|---|
committer | David E. O'Brien <obrien@FreeBSD.org> | 2001-05-28 05:21:37 +0000 |
commit | c9edceadd8a0c5acc1f58da35396d952bdaaf786 (patch) | |
tree | ae2a6f4f4987889b7bd2af7bdf0b86fa580df011 /contrib/binutils/bfd/binary.c | |
parent | bf9a5db426c4b39201fc3149bbed3c8f14edbe86 (diff) |
Import of GNU Binutils version 2.11.0.
Believe it or not, this is heavily stripped down.
Notes
Notes:
svn path=/vendor/binutils/dist/; revision=77298
Diffstat (limited to 'contrib/binutils/bfd/binary.c')
-rw-r--r-- | contrib/binutils/bfd/binary.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/contrib/binutils/bfd/binary.c b/contrib/binutils/bfd/binary.c index c2980b02621a..771e4312f730 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 }; |