binutils Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
binutils/hppa

Binutils linker handles HPPA ldil/addl sequences for PIC relocations.

HPPA linker now supports dynamic relocations for ldil/addl sequences in PIC objects, improving linking of shared executables.

The binutils linker has been updated to correctly handle dynamic relocations for ldil/addl instruction sequences on the HPPA architecture. This change allows the linker to properly convert PIC register usage (%r19) to the DP register (%r27) in non-shared executables, even when addl immediately follows ldil. This resolves issues caused by the previous limitation that only supported addil instructions, which had stricter register constraints.

In Details

This patch enhances bfd/elf32-hppa.c's final_link_relocate function to support R_PARISC_DLTIND21L and R_PARISC_DPREL21L relocations for ldil/addl instruction sequences. Previously, only addil was supported, which limited the linker's ability to handle PIC code generation on HPPA without register spills. This update allows the linker to inspect the addl instruction following ldil to correctly rewrite the general register to %dp or %r0, resolving PR rtl-optimization/127142.

For Context
PIC
Position-Independent Code. Code that can be loaded and executed at any memory address without modification. This is crucial for shared libraries.
Relocation
A process performed by the linker to adjust symbolic addresses in machine code after it has been compiled, so that it can be loaded at a specific memory address. Dynamic relocations are those that are resolved at runtime.
ldil/addl
Specific HPPA machine instructions. ldil likely loads a 21-bit immediate value into a register, and addl adds to it. This sequence is used for addressing data relative to a base register.
DP register
Data Pointer register. On some architectures like HPPA, a dedicated register used as a base pointer for accessing global or static data.
HPPA
Hewlett-Packard Precision Architecture, a RISC instruction set architecture.
LRA
Link-Time Register Allocation. A GCC optimization pass that attempts to allocate registers during the linking phase.
Filed Under: binutilslinkerhpparelocationPIC