From ce18e1939438eb4160c6b7d91437a90393eba9ac Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Thu, 2 Feb 2023 13:03:10 -0700 Subject: [PATCH] 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);