[4/5] LoongArch: Remove "elf_seg_map (info->output_bfd) == NULL" relaxation condition
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_binutils_check--master-arm |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_binutils_build--master-arm |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 |
success
|
Testing passed
|
Commit Message
---
bfd/elfnn-loongarch.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
Comments
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),
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),
>
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),
On Mon, 2023-10-30 at 16:00 +0800, mengqinggang wrote:
> There are still some other modifications that need to be addend,
> and prepare to test whether a clfs system can be successfully
> compiled.
Ping again. We are very close to the end of GCC 14 stage 1, and we need
to determine if we should default to -mno-relax for -fpic (i. e.
disabling relaxation for anything that may be used in a shared object).
Silently producing broken shared object is not acceptable.
> 在 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),
>
I will send a new patch today, it fix some bugs caused by address changed.
在 2023/11/16 上午8:03, Xi Ruoyao 写道:
> On Mon, 2023-10-30 at 16:00 +0800, mengqinggang wrote:
>> There are still some other modifications that need to be addend,
>> and prepare to test whether a clfs system can be successfully
>> compiled.
> Ping again. We are very close to the end of GCC 14 stage 1, and we need
> to determine if we should default to -mno-relax for -fpic (i. e.
> disabling relaxation for anything that may be used in a shared object).
> Silently producing broken shared object is not acceptable.
>
>> 在 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),
@@ -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),