[PATCH 4/5] LoongArch: Remove "elf_seg_map (info->output_bfd) == NULL" relaxation condition

mengqinggang mengqinggang@loongson.cn
Mon Oct 30 08:00:37 GMT 2023


There are still some other modifications that need to be addend,
and prepare to test whether a clfs system can be successfully compiled.


在 2023/10/30 下午1:14, Xi Ruoyao 写道:
> Ping.
>
> Is there any reason holding this patch?
>
> On Thu, 2023-10-19 at 22:04 +0800, Xi Ruoyao wrote:
>> Hi,
>>
>> I don't know BFD very well, but IMO this should be applied and
>> backported to 2.41 ASAP because "not relaxing shared objects" is a
>> very
>> serious issue.
>>
>> On Fri, 2023-10-13 at 16:24 +0800, mengqinggang wrote:
>>> ---
>>>   bfd/elfnn-loongarch.c | 6 +++++-
>>>   1 file changed, 5 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c
>>> index 47334943fde..38a25b63813 100644
>>> --- a/bfd/elfnn-loongarch.c
>>> +++ b/bfd/elfnn-loongarch.c
>>> @@ -3747,6 +3747,11 @@ loongarch_relax_pcala_addi (bfd *abfd,
>>> asection *sec,
>>>     uint32_t pca = bfd_get (32, abfd, contents + rel_hi->r_offset);
>>>     uint32_t add = bfd_get (32, abfd, contents + rel_lo->r_offset);
>>>     uint32_t rd = pca & 0x1f;
>>> +
>>> +  /* Because previous sections' relax, output_offset may increase
>>> and need to
>>> +     be updated before relax. But it update after relax in
>>> +     size_input_section defaultly, so we manually updating here.
>>> */
>>> +  sec->output_offset = sec->output_section->size;
>>>     bfd_vma pc = sec_addr (sec) + rel_hi->r_offset;
>>>     const uint32_t addi_d = 0x02c00000;
>>>     const uint32_t pcaddi = 0x18000000;
>>> @@ -3889,7 +3894,6 @@ loongarch_elf_relax_section (bfd *abfd,
>>> asection *sec,
>>>         || sec->sec_flg0
>>>         || (sec->flags & SEC_RELOC) == 0
>>>         || sec->reloc_count == 0
>>> -      || elf_seg_map (info->output_bfd) == NULL
>>>         || (info->disable_target_specific_optimizations
>>>   	  && info->relax_pass == 0)
>>>         /* The exp_seg_relro_adjust is enum phase_enum (0x4),



More information about the Binutils mailing list