binutils Newspaper
NOVEMBER 30, 2026
bfd/nds32 — Proposed

bfd/nds32: remove unused got_size variable

Remove unused `got_size` variable from Andes NDS32 ELF support.

Simon Marchi is removing the got_size variable from the Andes NDS32 ELF support in bfd/elf32-nds32.c. This variable has been unused since its introduction in 2013 and causes a build failure with recent Clang versions due to the -Wunused-but-set-global warning. The patch also merges sections related to .got and .got.plt into the .plt handling.

In the Thread 1 participant
  1. Simon Marchi proposer

    Proposes removing the unused `got_size` variable from `elf32-nds32.c`, which causes build errors.

    “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 .…”

In Details

This patch removes an unused variable got_size and associated logic from bfd/elf32-nds32.c. This variable was intended to track the size of Global Offset Table (GOT) sections for the Andes NDS32 architecture but has been unused since its introduction in 2013. The nds32_elf_late_size_sections function, which used got_size, now has its logic for .got and .got.plt sections merged with the handling for .plt, as these sections are not independently managed in this context. The change resolves a compiler warning and simplifies the code.

For Context
Global Offset Table (GOT)
A table used in position-independent executable (PIE) code to store addresses of external functions and variables, allowing them to be resolved at runtime.
bfd.h
Header file for the Binary File Descriptor (BFD) library, which provides a common interface to manipulate various executable file formats.
nds32
A 32-bit instruction set architecture developed by Andes Technology Corporation.
ELF
Executable and Linkable Format, a standard file format for executables, object code, shared libraries, and core dumps on many Unix-like systems.
Filed Under: cleanupbuildlinkernds32