aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2017-06-28 11:00:13 -0700
committerH.J. Lu <hjl.tools@gmail.com>2017-06-28 11:01:21 -0700
commit47fdcf63c04b5c220974affc8ff1d9ef8a041919 (patch)
treeedb5303ef9da47d2786c33f950721cbb70f44d68
parent6e75794e9da0e12b44c36272e16d18449d25a03d (diff)
downloadgdb-47fdcf63c04b5c220974affc8ff1d9ef8a041919.zip
gdb-47fdcf63c04b5c220974affc8ff1d9ef8a041919.tar.gz
gdb-47fdcf63c04b5c220974affc8ff1d9ef8a041919.tar.bz2
Change bfd_get_size/bfd_get_file_size to ufile_ptr
bfd_get_size and bfd_get_file_size should return the unsigned file size. Otherwise they return negative values for file >= 2GB with 32-bit ufile_ptr. bfd/ * bfd-in2.h: Regenerated. * bfdio.c (bfd_get_size): Change return type to ufile_ptr. (bfd_get_file_size): Likewise. binutils/ * objdump.c (dump_relocs_in_section): Cast to ufile_ptr when comparing against bfd_get_file_size return.
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/bfd-in2.h4
-rw-r--r--bfd/bfdio.c8
-rw-r--r--binutils/ChangeLog5
-rw-r--r--binutils/objdump.c2
5 files changed, 18 insertions, 7 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 3f81ea4..561ac1b 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2017-06-28 H.J. Lu <hongjiu.lu@intel.com>
+
+ * bfd-in2.h: Regenerated.
+ * bfdio.c (bfd_get_size): Change return type to ufile_ptr.
+ (bfd_get_file_size): Likewise.
+
2017-06-28 Maciej W. Rozycki <macro@imgtec.com>
Matthew Fortune <matthew.fortune@imgtec.com>
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 971acb8..1343780 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -1240,9 +1240,9 @@ char *bfd_follow_build_id_debuglink (bfd *abfd, const char *dir);
/* Extracted from bfdio.c. */
long bfd_get_mtime (bfd *abfd);
-file_ptr bfd_get_size (bfd *abfd);
+ufile_ptr bfd_get_size (bfd *abfd);
-file_ptr bfd_get_file_size (bfd *abfd);
+ufile_ptr bfd_get_file_size (bfd *abfd);
void *bfd_mmap (bfd *abfd, void *addr, bfd_size_type len,
int prot, int flags, file_ptr offset,
diff --git a/bfd/bfdio.c b/bfd/bfdio.c
index e301570..fa7fb21 100644
--- a/bfd/bfdio.c
+++ b/bfd/bfdio.c
@@ -392,7 +392,7 @@ FUNCTION
bfd_get_size
SYNOPSIS
- file_ptr bfd_get_size (bfd *abfd);
+ ufile_ptr bfd_get_size (bfd *abfd);
DESCRIPTION
Return the file size (as read from file system) for the file
@@ -420,7 +420,7 @@ DESCRIPTION
size reasonable?".
*/
-file_ptr
+ufile_ptr
bfd_get_size (bfd *abfd)
{
struct stat buf;
@@ -439,7 +439,7 @@ FUNCTION
bfd_get_file_size
SYNOPSIS
- file_ptr bfd_get_file_size (bfd *abfd);
+ ufile_ptr bfd_get_file_size (bfd *abfd);
DESCRIPTION
Return the file size (as read from file system) for the file
@@ -448,7 +448,7 @@ DESCRIPTION
*/
-file_ptr
+ufile_ptr
bfd_get_file_size (bfd *abfd)
{
if (abfd->my_archive != NULL
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index c5b8f19..f0ecdc6 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,8 @@
+2017-06-28 H.J. Lu <hongjiu.lu@intel.com>
+
+ * objdump.c (dump_relocs_in_section): Cast to ufile_ptr when
+ comparing against bfd_get_file_size return.
+
2017-06-28 Nick Clifton <nickc@redhat.com>
* objcopy.c (merge_gnu_build_notes): Add support for version 2 notes.
diff --git a/binutils/objdump.c b/binutils/objdump.c
index ed8c645..0b72818 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -3388,7 +3388,7 @@ dump_relocs_in_section (bfd *abfd,
}
if ((bfd_get_file_flags (abfd) & (BFD_IN_MEMORY | BFD_LINKER_CREATED)) == 0
- && relsize > bfd_get_file_size (abfd))
+ && (ufile_ptr) relsize > bfd_get_file_size (abfd))
{
printf (" (too many: 0x%x)\n", section->reloc_count);
bfd_set_error (bfd_error_file_truncated);