hppa: Fix register extraction for ldil+addl relocation handling
Corrects relocation processing for HPPA `ldil` and `addl` instructions in binutils.
This change fixes two issues in the HPPA ELF linker’s handling of relocations for ldil and addl instruction sequences. It corrects the bit manipulation used to extract the target address from the ldil instruction and ensures that the relocation conversion from R_PARISC_DLTIND21L to R_PARISC_DPREL21L correctly accepts any base register, addressing cases where GCC emits different base registers under LRA.
In Details
In bfd/elf32-hppa.c, the final_link_relocate function handles relocations for HPPA. This commit rectifies the extraction of the target address from ldil instructions by correcting the bit shift operation. Additionally, it updates the relocation conversion logic for R_PARISC_DLTIND21L to R_PARISC_DPREL21L to be more lenient regarding the base register used in the associated addl instruction, accommodating variations generated by GCC's LRA (Late Register Allocation).
- HPPA
- Hewlett-Packard Precision Architecture, a RISC instruction set architecture.
- ELF
- Executable and Linkable Format, a standard file format for object code, executables, and shared libraries.
- ldil
- Load Immediate Long, an instruction on HPPA that loads a 21-bit immediate value into a register.
- addl
- Add Long, an instruction that adds two operands, typically used in conjunction with
ldilfor addressing. - R_PARISC_DLTIND21L
- A relocation type specific to HPPA, used for addressing related to load immediate instructions.
- R_PARISC_DPREL21L
- Another HPPA relocation type, related to data-relative addressing.
- LRA
- Late Register Allocation, an optimization pass in compilers that assigns registers to variables after most other optimizations.