xtensa: add R_XTENSA_PDIFF_ULEB128 for DWARF uleb128 diffs
Introduces a new relocation type for Xtensa to better handle DWARF 5 uleb128 differences, enabling linker relaxation for functions with debug info.
This patch introduces a new relocation type, R_XTENSA_PDIFF_ULEB128, for the Xtensa architecture to improve the handling of unsigned LEB128 (uleb128) differences in DWARF 5 debug information. Previously, DWARF 5’s use of uleb128 for symbol differences forced code containing this debug info to be marked no_transform, effectively disabling linker relaxation for nearly every function. The new relocation allows the linker to rewrite the padded uleb128 value in place after relaxation, thus enabling relaxation for functions with DWARF 5 debug info.
- proposer
Proposes adding R_XTENSA_PDIFF_ULEB128 relocation type to support DWARF 5 uleb128 differences, enabling linker relaxation for functions with debug info.
In Details
This patch targets the Xtensa toolchain support within GNU Binutils and GAS. It addresses a limitation in how DWARF 5 debug information uses uleb128 to encode differences between symbol locations and range lists. Previously, the assembler had to prevent linker relaxation (no_transform) for code containing these uleb128 differences, hindering optimization. This patch introduces a new relocation type (R_XTENSA_PDIFF_ULEB128) that allows the assembler to pad the uleb128 value and the linker to rewrite it in place after relaxation, effectively re-enabling relaxation for such code sectio…
- DWARF 5
- The fifth version of the DWARF debugging data format standard. It includes enhancements for representing debug information more efficiently and expressively.
- uleb128
- Unsigned LEB128 (Little Endian Base 128) is a variable-length encoding format used for representing unsigned integers. It's compact for small numbers but can grow for larger ones.
- linker relaxation
- An optimization process performed by the linker where it adjusts machine code to use shorter, more efficient instruction forms after the initial object code has been generated. This often involves changing absolute addresses or offsets to relative ones.
- no_transform
- A flag or directive used in object files that tells the linker not to attempt any optimizations or modifications (like relaxation) on the associated code or data section.
- Xtensa
- A configurable processor architecture commonly used in embedded systems. Toolchain support for Xtensa involves specific instructions and relocation types.
- GAS
- The GNU Assembler, part of the GNU Binutils package. It translates assembly language code into machine code.