[RFC 4/4] ld: bfd: sframe: fix incorrect r_addend in RELA entries

Jens Remus jremus@linux.ibm.com
Tue Mar 25 15:21:20 GMT 2025


On 24.03.2025 19:11, Indu Bhagat wrote:
> On 3/10/25 6:16 AM, Jens Remus wrote:
>> On 08.03.2025 08:38, Indu Bhagat wrote:

>>> +bfd_vma
>>> +_bfd_elf_sframe_section_addend (bfd *output_bfd ATTRIBUTE_UNUSED,
>>> +                  struct bfd_link_info *info ATTRIBUTE_UNUSED,
>>> +                  asection *sec,
>>> +                  unsigned int reloc_index,
>>> +                  bfd_vma addend)
>>> +{
>>> +  struct sframe_dec_info *sfd_info;
>>> +
>>> +  if (sec->sec_info_type != SEC_INFO_TYPE_SFRAME)
>>> +    return addend;
>>> +
>>> +  sfd_info = (struct sframe_dec_info *) elf_section_data (sec)- >sec_info;
>>> +  BFD_ASSERT (sfd_info && sfd_info->sfd_ctx);
>>> +
>>> +  return (addend - (sframe_decoder_get_hdr_size (sfd_info->sfd_ctx)
>>> +            + reloc_index * sizeof (sframe_func_desc_entry)));
>>
>> IIUC this is only valid as long as reloc_index == fde_index.
>>
> 
> Yes, and reloc_index should be the fde_index for input sections.  Do
> you see any issue ?  I can add a comment around the same.

Thanks! No, not necessary,I just wanted to reassure that I understand
how/why it works.

Regards,
Jens
-- 
Jens Remus
Linux on Z Development (D3303)
+49-7031-16-1128 Office
jremus@de.ibm.com

IBM

IBM Deutschland Research & Development GmbH; Vorsitzender des Aufsichtsrats: Wolfgang Wendt; Geschäftsführung: David Faller; Sitz der Gesellschaft: Böblingen; Registergericht: Amtsgericht Stuttgart, HRB 243294
IBM Data Privacy Statement: https://www.ibm.com/privacy/



More information about the Binutils mailing list