binutils Newspaper
JULY 29, 2026
ld Proposed

ld: testsuite: Fix integer overflow in ld/testsuite/ld-elf/init-mixed.c.

Jan Beulich agrees with a patch fixing an integer overflow in a binutils linker test case, noting such assumptions are common.

Jan Beulich acknowledges a patch intended to fix an integer overflow in a binutils linker test case (ld/testsuite/ld-elf/init-mixed.c). The original patch noted that the code assumed int was 32 bits, which isn’t always true. Beulich agrees with the problem but points out that similar assumptions about int size are prevalent throughout the binutils source code.

In the Thread 2 participants
  1. Jan Beulich <jbeulich@suse.com> reviewer

    Agrees with the patch fixing an integer overflow in a test case, acknowledging that assumptions about 'int' size are widespread in binutils.

    “In general I agree, yet I'm certain there are many instances of this assumption throughout binutils sources.”
  2. Jan Dubiec contributor

    Submitted the original patch identifying the integer overflow issue.

    “The code assumes that int is 32 bits wide (see e.g. line 97), which is not necessarily true.”

Technical Tradeoffs

  • Correctness of test cases.
  • Portability and robustness of code relying on assumed integer sizes.

In Details

This discussion concerns a test case within the binutils linker (ld) test suite, specifically ld/testsuite/ld-elf/init-mixed.c. A patch was submitted to address an integer overflow bug caused by the test code assuming int is always 32 bits. Jan Beulich, a reviewer, agreed with the fix but noted that this assumption is a common pattern across the binutils codebase, implying that more systemic fixes might be necessary.

For Context
ld
The GNU linker, responsible for combining object files into an executable or library.
testsuite
A collection of tests designed to verify the correct functionality of a software package.
integer overflow
A condition that occurs when an arithmetic operation produces a result that exceeds the maximum value that can be stored in a variable of a fixed size.
int
A fundamental integer data type in C and C++. Its size (e.g., 16, 32, or 64 bits) is platform-dependent, though often 32 bits on common systems.
ELF
Executable and Linkable Format, a common standard file format for object files, executables, and shared libraries on Unix-like systems.
Filed Under: binutilsldtestsuiteinteger overflowc