binutils Newspaper
JUNE 15, 2026
bfd/s390+sh Proposed

Bfd/s390+sh: Don't abuse BFD_RELOC_32_GOT_PCREL

Fixes incorrect usage of a PC-relative relocation enumerator for non-PC-relative relocations in the s390 and SH backends of the Binary File Descriptor (BFD) li…

This patch corrects the usage of BFD_RELOC_32_GOT_PCREL in the s390 and SH backends of the BFD library. The enumerator was being incorrectly used for R_390_GOT32 and R_SH_GOT32 relocations, which are not PC-relative. Correcting this usage helps to properly use the enumerator and avoids potential issues in the future.

In the Thread 1 participant
  1. Alexandre Oliva <oliva@gnu.org> proposer

    Agrees to the changes for SH.

    “SH bits look good, thanks.”

In Details

The BFD library uses relocation enumerators to describe how to adjust addresses in object files during linking. This patch corrects the use of BFD_RELOC_32_GOT_PCREL which specifies a 32-bit relocation relative to the Program Counter (PC). The s390 and SH backends were incorrectly using it for non-PC-relative GOT relocations.

For Context

The Binary File Descriptor (BFD) library is a part of GNU binutils that provides a uniform interface for manipulating different object file formats. Relocations are adjustments applied to addresses within object files or executables during linking or loading, to account for the final memory location of code and data. PC-relative relocations calculate addresses relative to the current instruction's location. This patch fixes an incorrect assumption about which relocations are PC-relative, ensuring correct code execution.

Filed Under: bfdrelocations390shcode quality