aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-microblaze.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2021-12-03 16:31:09 -0500
committerSimon Marchi <simon.marchi@polymtl.ca>2021-12-14 08:47:48 -0500
commit9bc8e54b1f1c281c7a4ecf49a4e9300e334beb0a (patch)
treea14d07055ccb22a4858f58147c5492ca55460425 /bfd/elf32-microblaze.c
parent78d4da9ae0d3447f28274a00b278f58ca7d8d1b2 (diff)
downloadgdb-9bc8e54b1f1c281c7a4ecf49a4e9300e334beb0a.zip
gdb-9bc8e54b1f1c281c7a4ecf49a4e9300e334beb0a.tar.gz
gdb-9bc8e54b1f1c281c7a4ecf49a4e9300e334beb0a.tar.bz2
bfd: fix -Wunused errors with clang 13+
Clang 13 and 14 produce some -Wunused-but-set-{variable,parameter} for situations where gcc doesn't. In particular, when a variable is set and then used in a way to update its own value. For example, if `i` is only used in this way: int i = 2; i++; i = i + 1; gcc won't warn, but clang will. Fix all such errors found in an --enable-targets=all build. It would be important for somebody who knows what they're doing to just make sure that these variables can indeed be deleted, and that there a no cases where it's a bug, and the variable should actually be used. The first instance of this error fix by this patch is: CC elf32-score.lo /home/simark/src/binutils-gdb/bfd/elf32-score.c:450:11: error: variable 'relocation' set but not used [-Werror,-Wunused-but-set-variable] bfd_vma relocation; ^ Change-Id: I2f233ce20352645cf388aff3dfa08a651d21a6b6
Diffstat (limited to 'bfd/elf32-microblaze.c')
-rw-r--r--bfd/elf32-microblaze.c14
1 files changed, 0 insertions, 14 deletions
diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
index d9c0d93..b05ee9b 100644
--- a/bfd/elf32-microblaze.c
+++ b/bfd/elf32-microblaze.c
@@ -2088,8 +2088,6 @@ microblaze_elf_relax_section (bfd *abfd,
if (isym->st_shndx == shndx
&& (ELF32_ST_TYPE (isym->st_info) == STT_SECTION))
{
- bfd_vma immediate;
-
if (ocontents == NULL)
{
if (elf_section_data (o)->this_hdr.contents != NULL)
@@ -2112,15 +2110,7 @@ microblaze_elf_relax_section (bfd *abfd,
elf_section_data (o)->this_hdr.contents = ocontents;
}
}
- unsigned long instr_hi = bfd_get_32 (abfd, ocontents
- + irelscan->r_offset);
- unsigned long instr_lo = bfd_get_32 (abfd, ocontents
- + irelscan->r_offset
- + INST_WORD_SIZE);
- immediate = (instr_hi & 0x0000ffff) << 16;
- immediate |= (instr_lo & 0x0000ffff);
offset = calc_fixup (irelscan->r_addend, 0, sec);
- immediate -= offset;
irelscan->r_addend -= offset;
}
}
@@ -2326,7 +2316,6 @@ microblaze_elf_check_relocs (bfd * abfd,
{
Elf_Internal_Shdr * symtab_hdr;
struct elf_link_hash_entry ** sym_hashes;
- struct elf_link_hash_entry ** sym_hashes_end;
const Elf_Internal_Rela * rel;
const Elf_Internal_Rela * rel_end;
struct elf32_mb_link_hash_table *htab;
@@ -2341,9 +2330,6 @@ microblaze_elf_check_relocs (bfd * abfd,
symtab_hdr = & elf_tdata (abfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (abfd);
- sym_hashes_end = sym_hashes + symtab_hdr->sh_size / sizeof (Elf32_External_Sym);
- if (!elf_bad_symtab (abfd))
- sym_hashes_end -= symtab_hdr->sh_info;
rel_end = relocs + sec->reloc_count;