binutils Newspaper
NOVEMBER 30, 2026
ld — Proposed — Sentiment 7 / 10

ld: arm: Test Thumb PLT sizing after attribute merging

Adds a test case to verify correct Thumb PLT sizing in the ARM linker after attribute merging, addressing a previously fixed overflow bug.

Torbjörn Svensson submits a patch to add a regression test for an issue in the ARM linker’s Procedure Linkage Table (PLT) sizing when handling Thumb code. The issue, fixed in binutils 2.47.0, caused an overflow due to a mismatch between PLT header and entry sizes when merging attributes from different object files. This test specifically targets Thumb-only targets with Thumb-2 support.

In the Thread 3 participants
  1. Torbjörn SVENSSON <torbjorn.svensson@foss.st.com> proposer

    Submits a patch to add a regression test for a Thumb PLT sizing bug in the ARM linker, seeking approval for master and binutils-2_47-branch.

    “Add regression coverage for bd8942a0e049a466f9b649364bf53445fb47dd0c. I stumbled upon the PLT sizing bug fixed by the above commit when linking the GCC LTO test pr87906 with -shared for a Thumb-only arm-none-eabi target with Thumb-2 support.”
  2. Christophe Lyon <christophe.lyon@arm.com> reviewer

    Seeks clarification on whether the submitted patch only adds a test case.

    “Hi Torbjörn! Do IUC that: - your patch only adds a test, and it”
  3. Torbjorn SVENSSON <torbjorn.svensson@foss.st.com> contributor

    Confirms that the patch adds a test case for the PLT sizing bug, and that the bug itself was fixed in an earlier commit.

    “Yes, the patch only adds a test. The actual fix for the PLT sizing bug (bd8942a0e049a466f9b649364bf53445fb47dd0c) is already in master and binutils-2_47-branch.”

Technical Tradeoffs

  • Adds test coverage, improving confidence in the fix for the PLT sizing bug.
  • The test is specific to ARM Thumb targets, limiting its broader applicability.

In Details

This patch introduces a regression test for an ARM-specific bug in the GNU linker (ld) related to Procedure Linkage Table (PLT) generation for Thumb code. The bug involved an overflow when calculating PLT entry sizes due to a mismatch in ARM attributes between input objects, leading to corrupted PLT instructions. The test targets Thumb-only targets with Thumb-2 support, as Thumb-1-only targets are handled differently.

For Context
PLT
Procedure Linkage Table. A table used by dynamic linkers to resolve function calls to shared libraries at runtime. It acts as an indirection layer.
Thumb
An instruction set architecture for ARM processors, typically offering more compact code than the standard ARM instruction set.
ARM attributes
Metadata embedded in object files that describes architectural features, such as the instruction set (ARM or Thumb) and processor variant, used by the linker to ensure compatibility.
regression test
A test designed to ensure that a previously fixed bug does not reappear after code changes.
attribute merging
The process by which the linker combines architectural or target-specific attributes from multiple input object files to determine the properties of the final executable.
Filed Under: linkerARMThumbPLTtesting