[PATCH 6/8] bfd/ELF: fold BFD_RELOC_<arch>_GOTPC*

Jan Beulich jbeulich@suse.com
Thu Mar 19 07:38:49 GMT 2026


On 13.03.2026 18:30, Jens Remus wrote:
> On 3/13/2026 10:57 AM, Jan Beulich wrote:
>> For many of the cases there's no need to have separate relocs per arch;
>> just like for other more or less generic ones a single one (per purpose;
>> a 64-bit generic one is being introduced) will do. C-Sky - sadly -
>> continues to be an exception.
>> ---
>> Why is it that BFD_RELOC_386_GOTPC (but not BFD_RELOC_X86_64_GOTPC{32,64})
>> is among the types checked in TC_FORCE_RELOCATION_LOCAL()? Without that,
>> BFD_RELOC_X86_64_GOTPC32 type could also be replaced by
>> BFD_RELOC_32_PLT_PCREL, then even simplifying at least one expression.
> 
> Likewise to previous patch I am wondering whether this isn't an API-
> breaking change.
> 
> On s390 the R_390_GOTPC is either 32-bit or 64-bit.  That probably needs
> to be addressed.  So either introduce a BFD_RELOC_64_GOT_PCREL (for s390)
> or not make this change for s390 at all.  Thoughts?

I.e. you're saying that ...

>> --- a/bfd/bfd-in2.h
>> +++ b/bfd/bfd-in2.h
> 
>> @@ -5377,9 +5372,6 @@ enum bfd_reloc_code_real
>>    /* 32 bit GOT offset.  */
>>    BFD_RELOC_390_GOT32,
>>  
>> -  /* 32 bit PC relative offset to GOT.  */
>> -  BFD_RELOC_390_GOTPC,

... the comment here has been wrong for a long time? If so, yes, something
will need doing. I'll have to check more closely which of the two variants
may be better. It seems well possible that BFD_RELOC_64_GOT_PCREL might
find other uses.

Jan


More information about the Binutils mailing list