[binutils-gdb] PowerPC, use size_t rather than long for indices

Alan Modra amodra@sourceware.org
Thu Dec 19 11:29:00 GMT 2019


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=9ad9b810c385c83242a3100fa986d174c83ffe10

commit 9ad9b810c385c83242a3100fa986d174c83ffe10
Author: Alan Modra <amodra@gmail.com>
Date:   Thu Dec 19 15:17:12 2019 +1030

    PowerPC, use size_t rather than long for indices
    
    This is fussing about nothing really but since I was looking at signed
    vs. unsigned issues, I decided to use the correct types here.
    
    	* elf32-ppc.c (ppc_elf_get_synthetic_symtab): Use size_t for vars.
    	* elf64-ppc.c (sym_exists_at): Use size_t for lo, hi and mid.

Diff:
---
 bfd/ChangeLog   | 5 +++++
 bfd/elf32-ppc.c | 2 +-
 bfd/elf64-ppc.c | 5 +++--
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 5d55a41..302ee5e 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,10 @@
 2019-12-18  Alan Modra  <amodra@gmail.com>
 
+	* elf32-ppc.c (ppc_elf_get_synthetic_symtab): Use size_t for vars.
+	* elf64-ppc.c (sym_exists_at): Use size_t for lo, hi and mid.
+
+2019-12-18  Alan Modra  <amodra@gmail.com>
+
 	* elf-bfd.h (ELF_LOCAL_SYMBOL_HASH): Avoid signed overflow.
 	* elf32-hppa.c (final_link_relocate): Likewise.
 	* elf32-ppc.c (_bfd_elf_ppc_at_tls_transform): Likewise.
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 71c35ad..9c1d1b3 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -1802,7 +1802,7 @@ ppc_elf_get_synthetic_symtab (bfd *abfd, long symcount, asymbol **syms,
   bfd_vma stub_off;
   asymbol *s;
   arelent *p;
-  long count, i, stub_delta;
+  size_t count, i, stub_delta;
   size_t size;
   char *names;
   bfd_byte buf[4];
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 52a96cf..e475421 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -2120,9 +2120,10 @@ compare_symbols (const void *ap, const void *bp)
 /* Search SYMS for a symbol of the given VALUE.  */
 
 static asymbol *
-sym_exists_at (asymbol **syms, long lo, long hi, unsigned int id, bfd_vma value)
+sym_exists_at (asymbol **syms, size_t lo, size_t hi, unsigned int id,
+	       bfd_vma value)
 {
-  long mid;
+  size_t mid;
 
   if (id == (unsigned) -1)
     {



More information about the Binutils-cvs mailing list