git: ce18e1939438 - main - stand: only compute symidx on x86

From: Warner Losh <imp_at_FreeBSD.org>
Date: Thu, 02 Feb 2023 20:07:35 UTC
The branch main has been updated by imp:

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

commit ce18e1939438eb4160c6b7d91437a90393eba9ac
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2023-02-02 20:03:10 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2023-02-02 20:04:05 +0000

    stand: only compute symidx on x86
    
    We only use symidx on x86, so only compute it on x86 to fix a set but
    not used warning on aarch64.
    
    Sponsored by:           Netflix
    Reviewed by:            kevans
    Differential Revision:  https://reviews.freebsd.org/D38246
---
 stand/common/reloc_elf.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/stand/common/reloc_elf.c b/stand/common/reloc_elf.c
index 262091b9f6c6..f143b20eee5c 100644
--- a/stand/common/reloc_elf.c
+++ b/stand/common/reloc_elf.c
@@ -56,7 +56,10 @@ __elfN(reloc)(struct elf_file *ef, symaddr_fn *symaddr, const void *reldata,
     __ELF_WORD_SIZE == 64
 	Elf64_Addr *where, val;
 	Elf_Addr addend, addr;
-	Elf_Size rtype, symidx;
+	Elf_Size rtype;
+#if defined(__amd64__) || defined(__i386__)
+	Elf_Size symidx;
+#endif
 	const Elf_Rel *rel;
 	const Elf_Rela *rela;
 
@@ -67,7 +70,9 @@ __elfN(reloc)(struct elf_file *ef, symaddr_fn *symaddr, const void *reldata,
 		    dataaddr);
 		addend = 0;
 		rtype = ELF_R_TYPE(rel->r_info);
+#if defined(__amd64__) || defined(__i386__)
 		symidx = ELF_R_SYM(rel->r_info);
+#endif
 		addend = 0;
 		break;
 	case ELF_RELOC_RELA:
@@ -76,7 +81,9 @@ __elfN(reloc)(struct elf_file *ef, symaddr_fn *symaddr, const void *reldata,
 		    dataaddr);
 		addend = rela->r_addend;
 		rtype = ELF_R_TYPE(rela->r_info);
+#if defined(__amd64__) || defined(__i386__)
 		symidx = ELF_R_SYM(rela->r_info);
+#endif
 		break;
 	default:
 		return (EINVAL);