git: 97530894fc14 - main - kldxref: fix build on 32 bits arches

From: Baptiste Daroussin <bapt_at_FreeBSD.org>
Date: Wed, 13 Dec 2023 11:05:10 UTC
The branch main has been updated by bapt:

URL: https://cgit.FreeBSD.org/src/commit/?id=97530894fc142a9c44a5909e6ae668dc95a5036a

commit 97530894fc142a9c44a5909e6ae668dc95a5036a
Author:     Baptiste Daroussin <bapt@FreeBSD.org>
AuthorDate: 2023-12-13 08:19:18 +0000
Commit:     Baptiste Daroussin <bapt@FreeBSD.org>
CommitDate: 2023-12-13 11:04:43 +0000

    kldxref: fix build on 32 bits arches
---
 usr.sbin/kldxref/ef.h     | 4 ++--
 usr.sbin/kldxref/ef_obj.c | 4 ++--
 usr.sbin/kldxref/elf.c    | 6 +++---
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/usr.sbin/kldxref/ef.h b/usr.sbin/kldxref/ef.h
index a96bd72d6931..2909704bf2d1 100644
--- a/usr.sbin/kldxref/ef.h
+++ b/usr.sbin/kldxref/ef.h
@@ -218,7 +218,7 @@ int	elf_read_shdrs(struct elf_file *efile, size_t *nshdrp,
  * Read the dynamic table from a section of an ELF file into a
  * dynamically-allocated array of GElf_Dyn objects.
  */
-int	elf_read_dynamic(struct elf_file *efile, int section_index, long *ndynp,
+int	elf_read_dynamic(struct elf_file *efile, int section_index, size_t *ndynp,
     GElf_Dyn **dynp);
 
 /*
@@ -226,7 +226,7 @@ int	elf_read_dynamic(struct elf_file *efile, int section_index, long *ndynp,
  * dynamically-allocated array of GElf_Sym objects.
  */
 int	elf_read_symbols(struct elf_file *efile, int section_index,
-    long *nsymp, GElf_Sym **symp);
+    size_t *nsymp, GElf_Sym **symp);
 
 /*
  * Read a string table described by a section header of an ELF file
diff --git a/usr.sbin/kldxref/ef_obj.c b/usr.sbin/kldxref/ef_obj.c
index a1d46241b803..36c0dce432b6 100644
--- a/usr.sbin/kldxref/ef_obj.c
+++ b/usr.sbin/kldxref/ef_obj.c
@@ -82,7 +82,7 @@ struct ef_file {
 	int		nrel;
 
 	GElf_Sym	*ddbsymtab;	/* The symbol table we are using */
-	long		ddbsymcnt;	/* Number of symbols */
+	size_t		ddbsymcnt;	/* Number of symbols */
 	caddr_t		ddbstrtab;	/* String table */
 	long		ddbstrcnt;	/* number of bytes in string table */
 
@@ -155,7 +155,7 @@ ef_obj_symaddr(elf_file_t ef, GElf_Size symidx)
 {
 	const GElf_Sym *sym;
 
-	if (symidx >= (size_t)ef->ddbsymcnt)
+	if (symidx >= ef->ddbsymcnt)
 		return (0);
 	sym = ef->ddbsymtab + symidx;
 
diff --git a/usr.sbin/kldxref/elf.c b/usr.sbin/kldxref/elf.c
index a30eb4456a76..f8a6510ed352 100644
--- a/usr.sbin/kldxref/elf.c
+++ b/usr.sbin/kldxref/elf.c
@@ -329,7 +329,7 @@ out:
 }
 
 int
-elf_read_dynamic(struct elf_file *efile, int section_index, long *ndynp,
+elf_read_dynamic(struct elf_file *efile, int section_index, size_t *ndynp,
     GElf_Dyn **dynp)
 {
 	GElf_Shdr shdr;
@@ -365,14 +365,14 @@ elf_read_dynamic(struct elf_file *efile, int section_index, long *ndynp,
 }
 
 int
-elf_read_symbols(struct elf_file *efile, int section_index, long *nsymp,
+elf_read_symbols(struct elf_file *efile, int section_index, size_t *nsymp,
     GElf_Sym **symp)
 {
 	GElf_Shdr shdr;
 	Elf_Scn *scn;
 	Elf_Data *data;
 	GElf_Sym *sym;
-	long i, nsym;
+	size_t i, nsym;
 
 	scn = elf_getscn(efile->ef_elf, section_index);
 	if (scn == NULL)