binutils Newspaper
OCTOBER 6, 2026
xtensa — Proposed — Sentiment 7 / 10

xtensa: add R_XTENSA_PDIFF_ULEB128 for DWARF uleb128 diffs

Introduces R_XTENSA_PDIFF_ULEB128 relocation for DWARF 5 location/range lists.

This patch introduces a new relocation type, R_XTENSA_PDIFF_ULEB128, to handle differences in DWARF 5 location and range lists that are encoded as uleb128. Previously, such differences would force linker relaxation to be disabled for entire functions containing DWARF 5 debug info. This new relocation allows relaxation to continue by encoding these differences more efficiently.

In the Thread 2 participants
  1. Alexey Lapshin <alexey.lapshin@espressif.com> proposer

    Requests a review for the patch and suggests reserving reloc type 63 if a full review is not immediately possible.

    “Gentle ping. A review would be much appreciated. If review needs more time, could we at least reserve reloc type 63 for R_XTENSA_PDIFF_ULEB128?”
  2. Max Filippov <jcmvbkbc@gmail.com> reviewer

    Acknowledges the patch and indicates that the necessary changes for DWARF 5 location and range lists have been incorporated.

    “DWARF 5 location and range lists encode many same-section symbol differences as uleb128. Today the assembler must mark all covered code no_transform so linker relaxation cannot change those differences, which effectively disables relaxation for nearly every function that has DWARF 5 debug info. Emit R_XTENSA_PDIFF_ULEB128 instead: like R_XTENSA_PDIFF32 the difference stays in the section cont”

Technical Tradeoffs

  • Enables linker relaxation for functions with DWARF 5 debug info.
  • Introduces a new relocation type, increasing complexity.

In Details

This patch introduces R_XTENSA_PDIFF_ULEB128 to better support DWARF 5 location and range lists on Xtensa. These lists use uleb128 to encode differences between same-section symbols. Previously, the assembler had to disable linker relaxation (no_transform) for all code within such functions to prevent these differences from being altered. The new relocation allows relaxation to proceed by encoding these differences in a way that the linker can handle, specifically for Xtensa's DWARF support.

For Context
R_XTENSA_PDIFF_ULEB128
A new relocation type proposed for Xtensa, designed to encode unsigned little-endian base 128 differences used in DWARF debug information.
DWARF 5
The fifth version of the DWARF debugging data format specification.
uleb128
Unsigned Little Endian Base 128. A variable-length encoding used in DWARF for unsigned integers.
location lists
DWARF data structures that specify the address ranges where a variable is valid.
range lists
DWARF data structures used to indicate the address ranges of various program entities.
linker relaxation
An optimization process where the linker adjusts code or data addresses and instruction encodings to improve efficiency or code size.
Filed Under: binutilsxtensadwarfdebugginglinker