[binutils-gdb] bfd/nds32: remove unused got_size variable
Simon Marchi
simark@sourceware.org
Tue Nov 10 19:47:15 GMT 2026
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a38f78be05639d8b82a742f7031d48e315a4958b
commit a38f78be05639d8b82a742f7031d48e315a4958b
Author: Simon Marchi <simon.marchi@efficios.com>
Date: Fri Oct 30 11:00:32 2026 -0400
bfd/nds32: remove unused got_size variable
Building bfd with a recent clang fails with:
/home/smarchi/src/binutils-gdb/bfd/elf32-nds32.c:154:13: error: variable 'got_size' set but not used [-Werror,-Wunused-but-set-global]
The variable has been unused since it was introduced by commit
35c081572f32 ("Add support for Andes NDS32:", 2013-12-13). Remove it,
along with the comment that describes it. The branches handling the
.got and .got.plt sections in nds32_elf_late_size_sections become
empty, merge them with the one handling .plt.
Cc: Kuan-Lin Chen <kuanlinchentw@gmail.com>
Cc: Wei-Cheng Wang <cole945@gmail.com>
Diff:
---
bfd/elf32-nds32.c | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/bfd/elf32-nds32.c b/bfd/elf32-nds32.c
index 1c1cb4ca030..3792701cf12 100644
--- a/bfd/elf32-nds32.c
+++ b/bfd/elf32-nds32.c
@@ -150,8 +150,6 @@ enum
#define CONSERVATIVE_19BIT (0x40000 - 0x1000)
#define CONSERVATIVE_20BIT (0x80000 - 0x1000)
-/* Size of small data/bss sections, used to calculate SDA_BASE. */
-static long got_size = 0;
static int is_SDA_BASE_set = 0;
/* Convert ELF-VER in eflags to string for debugging purpose. */
@@ -4531,20 +4529,14 @@ nds32_elf_late_size_sections (struct bfd_link_info *info)
if ((s->flags & SEC_LINKER_CREATED) == 0)
continue;
- if (s == htab->root.splt)
+ if (s == htab->root.splt
+ || s == elf_hash_table (info)->sgot
+ || s == elf_hash_table (info)->sgotplt)
{
/* Strip this section if we don't need it; see the
comment below. */
;
}
- else if (s == elf_hash_table (info)->sgot)
- {
- got_size += s->size;
- }
- else if (s == elf_hash_table (info)->sgotplt)
- {
- got_size += s->size;
- }
else if (startswith (bfd_section_name (s), ".rela"))
{
if (s->size != 0 && s != elf_hash_table (info)->srelplt)
More information about the Binutils-cvs
mailing list