Use size_t in gdb_bfd_section_data

Message ID 20240315162351.2048830-1-tromey@adacore.com
State New
Headers
Series Use size_t in gdb_bfd_section_data |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 fail Patch failed to apply
linaro-tcwg-bot/tcwg_gdb_build--master-arm fail Patch failed to apply

Commit Message

Tom Tromey March 15, 2024, 4:23 p.m. UTC
  BFD recently changed bfd_mmap to use size_t, not bfd_size_type.  This
patch updates gdb_bfd_section_data to follow.  Without this patch, if
the two types ever differ, gdb would fail to build.
---
 gdb/gdb_bfd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Simon Marchi March 15, 2024, 5:33 p.m. UTC | #1
On 3/15/24 12:23, Tom Tromey wrote:
> BFD recently changed bfd_mmap to use size_t, not bfd_size_type.  This
> patch updates gdb_bfd_section_data to follow.  Without this patch, if
> the two types ever differ, gdb would fail to build.

My macos CI job (build only) has been failing since that commit, I'm
pretty sure it's related:

/Users/jenkins/build/workspace/binutils-gdb_master_macosbuild/platform/macos-amd64/target_board/unix/src/binutils-gdb/gdb/gdb_bfd.c:800:23: error: no matching function for call to 'bfd_mmap'
          descriptor->data = bfd_mmap (abfd, 0, descriptor->size, PROT_READ,
                             ^~~~~~~~
../bfd/bfd.h:2771:7: note: candidate function not viable: no known conversion from 'bfd_size_type *' (aka 'unsigned long long *') to 'size_t *' (aka 'unsigned long *') for 8th argument
void *bfd_mmap (bfd *abfd, void *addr, size_t len,
      ^

With the hope that it will fix it:

Approved-By: Simon Marchi <simon.marchi@efficios.com>

Simon
  

Patch

diff --git a/gdb/gdb_bfd.c b/gdb/gdb_bfd.c
index 4df1e66a388..3b1df4897a3 100644
--- a/gdb/gdb_bfd.c
+++ b/gdb/gdb_bfd.c
@@ -71,9 +71,9 @@  gdb_bfd_unlock (void *ignore)
 struct gdb_bfd_section_data
 {
   /* Size of the data.  */
-  bfd_size_type size;
+  size_t size;
   /* If the data was mmapped, this is the length of the map.  */
-  bfd_size_type map_len;
+  size_t map_len;
   /* The data.  If NULL, the section data has not been read.  */
   void *data;
   /* If the data was mmapped, this is the map address.  */