From d0975d800285f61d60cd7c3f47b185304a09a052 Mon Sep 17 00:00:00 2001 From: Tsukasa OI Date: Thu, 15 Sep 2022 04:06:09 +0000 Subject: bfd, binutils, gas: Remove/mark unused variables Clang generates a warning on unused (technically, written but not read thereafter) variables. By the default configuration (with "-Werror"), it causes a build failure (unless "--disable-werror" is specified). This commit adds ATTRIBUTE_UNUSED attribute to some of them, which means they are *possibly* unused (can be used but no warnings occur when unused) and removes others. bfd/ChangeLog: * elf32-lm32.c (lm32_elf_size_dynamic_sections): Mark unused rgot_count variable. * elf32-nds32.c (elf32_nds32_unify_relax_group): Remove unused count variable. * mmo.c (mmo_scan): Mark unused lineno variable. binutils/ChangeLog: * windmc.c (write_rc): Remove unused i variable. gas/ChangeLog: * config/tc-riscv.c (riscv_ip): Remove unused argnum variable. ld/ChangeLog: * pe-dll.c (generate_reloc): Remove unused bi and page_count variables. --- ld/pe-dll.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'ld') diff --git a/ld/pe-dll.c b/ld/pe-dll.c index 92c33f5..338e2de 100644 --- a/ld/pe-dll.c +++ b/ld/pe-dll.c @@ -1510,8 +1510,7 @@ generate_reloc (bfd *abfd, struct bfd_link_info *info) int total_relocs = 0; int i; bfd_vma sec_page = (bfd_vma) -1; - bfd_vma page_ptr, page_count; - int bi; + bfd_vma page_ptr; bfd *b; struct bfd_section *s; @@ -1525,8 +1524,7 @@ generate_reloc (bfd *abfd, struct bfd_link_info *info) reloc_data = xmalloc (total_relocs * sizeof (reloc_data_type)); total_relocs = 0; - bi = 0; - for (bi = 0, b = info->input_bfds; b; bi++, b = b->link.next) + for (b = info->input_bfds; b; b = b->link.next) { arelent **relocs; int relsize, nrelocs; @@ -1721,7 +1719,6 @@ generate_reloc (bfd *abfd, struct bfd_link_info *info) sec_page = (bfd_vma) -1; reloc_sz = 0; page_ptr = (bfd_vma) -1; - page_count = 0; for (i = 0; i < total_relocs; i++) { @@ -1740,7 +1737,6 @@ generate_reloc (bfd *abfd, struct bfd_link_info *info) page_ptr = reloc_sz; reloc_sz += 8; sec_page = this_page; - page_count = 0; } bfd_put_16 (abfd, (rva & 0xfff) + (reloc_data[i].type << 12), @@ -1753,7 +1749,6 @@ generate_reloc (bfd *abfd, struct bfd_link_info *info) reloc_sz += 2; } - page_count++; } while (reloc_sz & 3) -- cgit v1.1