TUESDAY, NOVEMBER 10, 2026
bfd/nds32 — Committed
bfd/nds32: remove unused got_size variable
Removes an unused variable 'got_size' from the NDS32 ELF backend.
A build warning from clang [-Wunused-but-set-global] identified an unused ‘got_size’ variable in the NDS32 ELF backend. This variable has been obsolete since 2013. The patch removes it and merges empty .got and .got.plt section handling into the .plt handling.
In the Thread
- proposer
Identified an unused variable causing build warnings and proposed its removal.
“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 .…”
- maintainer
Accepted the patch.
“OK.”
Technical Tradeoffs
- Removes dead code, improving maintainability and reducing build warnings.
In Details
This patch cleans up the NDS32 ELF backend by removing an unused global variable 'got_size' that was identified by static analysis. The variable has been dead code since its introduction and its removal simplifies the section handling logic.
For Context
- ELF
- Executable and Linkable Format. A common standard file format for object files, executables, shared libraries, and core dumps on Unix-like systems.
- NDS32
- Andes NDS32, a 32-bit embedded processor architecture.
- .got
- Global Offset Table. A section in ELF object files used for position-independent code to access global variables and function addresses.
- .got.plt
- Global Offset Table for Procedure Linkage Table. Used in dynamically linked executables.
- .plt
- Procedure Linkage Table. A section in ELF object files used for dynamically linked executables to resolve external function calls.