bfd/nds32: remove unused got_size variable
Checks
| Context |
Check |
Description |
| linaro-tcwg-bot/tcwg_binutils_build--master-arm |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 |
success
|
Test passed
|
| linaro-tcwg-bot/tcwg_binutils_check--master-arm |
success
|
Test passed
|
Commit Message
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>
---
bfd/elf32-nds32.c | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
base-commit: 5ffe4ba215c0bc186b91c85739350a67a8f61a0f
Comments
On Fri, Oct 30, 2026 at 11:00:32AM -0400, Simon Marchi wrote:
> 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.
OK.
On 11/9/26 11:51 PM, Alan Modra wrote:
> On Fri, Oct 30, 2026 at 11:00:32AM -0400, Simon Marchi wrote:
>> 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.
>
> OK.
>
> --
> Alan Modra
Thanks, pushed.
Simon
@@ -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)