diff options
author | obrien <obrien@FreeBSD.org> | 2001-05-28 05:21:37 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 2001-05-28 05:21:37 +0000 |
commit | 328e45595b12375b6d16a846069507d25086abdb (patch) | |
tree | ae2a6f4f4987889b7bd2af7bdf0b86fa580df011 /contrib/binutils/bfd/binary.c | |
parent | 7fbb72605a1c3bcb81f8b6bb6297ffef30f84335 (diff) | |
download | FreeBSD-src-328e45595b12375b6d16a846069507d25086abdb.zip FreeBSD-src-328e45595b12375b6d16a846069507d25086abdb.tar.gz |
Import of GNU Binutils version 2.11.0.
Believe it or not, this is heavily stripped down.
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 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 }; |