Change bfd_get_size/bfd_get_file_size to ufile_ptr
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 28 Jun 2017 18:00:13 +0000 (11:00 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 28 Jun 2017 18:01:21 +0000 (11:01 -0700)
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.

bfd/ChangeLog
bfd/bfd-in2.h
bfd/bfdio.c
binutils/ChangeLog
binutils/objdump.c

index 3f81ea45d08f399d9adbc953ce120b68b3386f26..561ac1b352130aed30c9184ce6c3a862dd154af2 100644 (file)
@@ -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>
 
index 971acb8e188a461a1f3aaec2eefb80691c4c1eed..1343780c8ceb57e16df15a728df2056b5bb127f3 100644 (file)
@@ -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,
index e3015700d72b58079211fe78e55b04fd610da94c..fa7fb21c8c3612e5a9eb4c6707700be54b0061b3 100644 (file)
@@ -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
index c5b8f19b31166767fc1960805dad2b876a048917..f0ecdc675db0baa1f3ba95c5432c371e2a7c7124 100644 (file)
@@ -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.
index ed8c64589771477975ba9bc4cab0ef8dade2973b..0b72818264c491beba83d325bb9002f3ff7fa21d 100644 (file)
@@ -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);
This page took 0.037954 seconds and 4 git commands to generate.