[PATCH v1] LoongArch: Add elfNN_loongarch_mkobject to initialize LoongArch tdata

Lulu Cai cailulu@loongson.cn
Mon Oct 14 01:13:25 GMT 2024


On 10/10/24 1:48 AM, Xi Ruoyao wrote:
> On Wed, 2024-09-18 at 15:07 +0800, Lulu Cai wrote:
>> Thanks, the patch has been applied.
> Hi,
>
> 2.43.1 can crash due to uninitialized tdata, for e.g. building Python
> 3.13.0 with PGO+LTO.  So IMO this should be backport this to 2.42 & 2.43
> release branches as well.
>
> Thanks!

Thanks, I'll deal with this later.

>> On 9/6/24 9:00 AM, Xin Wang wrote:
>>> LoongArch: Add elfNN_loongarch_mkobject to initialize LoongArch
>>> tdata.
>>>
>>> diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c
>>> index 69d81533a67..3e09579f018 100644
>>> --- a/bfd/elfnn-loongarch.c
>>> +++ b/bfd/elfnn-loongarch.c
>>> @@ -84,6 +84,14 @@ struct _bfd_loongarch_elf_obj_tdata
>>>       && elf_tdata (bfd) !=
>>> NULL						\
>>>       && elf_object_id (bfd) == LARCH_ELF_DATA)
>>>    
>>> +static bool
>>> +elfNN_loongarch_object (bfd *abfd)
>>> +{
>>> +  return bfd_elf_allocate_object (abfd,
>>> +				  sizeof (struct
>>> _bfd_loongarch_elf_obj_tdata),
>>> +				  LARCH_ELF_DATA);
>>> +}
>>> +
>>>    struct relr_entry
>>>    {
>>>      asection *sec;
>>> @@ -6144,6 +6152,8 @@ elf_loongarch64_hash_symbol (struct
>>> elf_link_hash_entry *h)
>>>    #define bfd_elfNN_bfd_reloc_name_lookup
>>> loongarch_reloc_name_lookup
>>>    #define elf_info_to_howto_rel NULL /* Fall through to
>>> elf_info_to_howto.  */
>>>    #define elf_info_to_howto loongarch_info_to_howto_rela
>>> +#define
>>> bfd_elfNN_mkobject						  \
>>> +  elfNN_loongarch_object
>>>    #define
>>> bfd_elfNN_bfd_merge_private_bfd_data				  \
>>>      elfNN_loongarch_merge_private_bfd_data
>>>    
>>



More information about the Binutils mailing list