Oh dear. I regret to inform you that commit 'More fixes for bfd_get_section_contents change' might be unfortunate
Commit Message
On Mon, Jun 26, 2017 at 11:34:50PM -0400, gdb-buildbot@sergiodj.net wrote:
> ../../binutils-gdb/bfd/libbfd.c:818:44: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
> || section->filepos + offset + count > filesz)
The types are file_ptr, file_ptr, bfd_size_type, unsigned file_ptr.
file_ptr is signed, bfd_size_type unsigned. The target is 32-bit, so
I guess the host is too, making bfd_size_type 32 bits. It must be
that file_ptr on the host is 64-bit, which is the only way I see the
left hand expression being signed.
PR binutils/21665
* libbfd.c (_bfd_generic_get_section_contents): Warning fix.
(_bfd_generic_get_section_contents_in_window): Likewise.
@@ -815,7 +815,7 @@ _bfd_generic_get_section_contents (bfd *abfd,
filesz = bfd_get_file_size (abfd);
if (offset + count < count
|| offset + count > sz
- || section->filepos + offset + count > filesz)
+ || (ufile_ptr) section->filepos + offset + count > filesz)
{
bfd_set_error (bfd_error_invalid_operation);
return FALSE;
@@ -873,7 +873,7 @@ _bfd_generic_get_section_contents_in_window
sz = section->size;
filesz = bfd_get_file_size (abfd);
if (offset + count > sz
- || section->filepos + offset + count > filesz
+ || (ufile_ptr) section->filepos + offset + count > filesz
|| ! bfd_get_file_window (abfd, section->filepos + offset, count, w,
TRUE))
return FALSE;