binutils Newspaper
NOVEMBER 30, 2026
ld/ppc32elf — Ready to Land

ld/ppc32elf: only define old_got for non-VxWorks targets

Patch cleans up unused 'old_got' variable for VxWorks targets in ppc32elf ld, now marked as ready.

This patch addresses an unused variable warning (‘old_got’) on VxWorks targets by conditionally defining it only for non-VxWorks builds. The variable was only used in ppc_after_check_relocs, which is not generated for VxWorks, and the --sdata-got option is also not registered for VxWorks. The reviewer (Surya Kumari Jangala) has approved it, marking it as ready for upstreaming.

In the Thread 2 participants
  1. Simon Marchi proposer

    Submitted a patch to move the definition of `old_got` and its handling inside non-VxWorks conditionals to fix a compiler warning.

    “Building ld with a recent clang fails with: eelf32ppcvxworks.c:68:12: error: variable 'old_got' set but not used [-Werror,-Wunused-but-set-global] old_got is only read in ppc_after_check_relocs, which is not generated for VxWorks. The --sdata-got option that sets it is not registered for VxWorks either. Move the variable and the handling of OPTION_OLD_GOT inside the existing non-VxWorks condit…”
  2. Surya Kumari Jangala <jskumari@linux.ibm.com> reviewer

    Approved the patch and confirmed it is ready for upstreaming.

    “LGTM, ok for upstreaming.”

Technical Tradeoffs

  • Removes a compiler warning and simplifies code by removing unused variables for specific targets.

In Details

This patch cleans up the ld/ppc32elf.em template by conditionally defining the old_got variable and its associated option parsing. Previously, old_got was globally defined but only used in code paths not taken on VxWorks targets, leading to a compiler warning with -Wunused-but-set-global. The change scopes old_got to non-VxWorks builds, resolving the warning and simplifying the template.

For Context
ld
The GNU linker, responsible for combining object files into an executable or library.
ppc32elf
Refers to the 32-bit PowerPC architecture using the ELF object file format.
VxWorks
A real-time operating system developed by Wind River Systems.
old_got
A variable likely related to the management of the Global Offset Table (GOT) in older linking schemes for PPC32 ELF targets.
Global Offset Table (GOT)
A data structure used in position-independent code (PIC) to store addresses of external symbols or functions, allowing indirect access.
sdata-got
A linker option that influences how small data sections are handled, potentially interacting with the GOT.
upstreaming
The process of submitting code changes to the official, main development branch of an open-source project.
Filed Under: binutilslinkerppc32VxWorkscode cleanup