* [PATCH 1/5] LoongArch: Fix ld --no-relax bug
@ 2023-10-13 8:24 mengqinggang
2023-10-13 8:24 ` [PATCH 2/5] LoongArch: Directly delete relaxed instuctions, not use R_LARCH_DELETE relocation mengqinggang
` (3 more replies)
0 siblings, 4 replies; 10+ messages in thread
From: mengqinggang @ 2023-10-13 8:24 UTC (permalink / raw)
To: binutils
Cc: xuchenghua, chenglulu, liuzhensong, xry111, i.swmail, maskray,
cailulu, mengqinggang
When ld --no-relax, pcalau12i + ld.d still can be relaxed.
---
bfd/elfnn-loongarch.c | 19 ++++++-------------
1 file changed, 6 insertions(+), 13 deletions(-)
diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c
index 70a666283af..471b5df3a9c 100644
--- a/bfd/elfnn-loongarch.c
+++ b/bfd/elfnn-loongarch.c
@@ -3996,29 +3996,22 @@ loongarch_elf_relax_section (bfd *abfd, asection *sec,
loongarch_relax_align (abfd, sec, sym_sec, info, rel, symval);
break;
case R_LARCH_DELETE:
- if (info->relax_pass == 1)
+ if (1 == info->relax_pass)
{
loongarch_relax_delete_bytes (abfd, sec, rel->r_offset, 4, info);
rel->r_info = ELFNN_R_INFO (0, R_LARCH_NONE);
}
break;
case R_LARCH_PCALA_HI20:
- if (info->relax_pass == 0)
- {
- if (i + 4 > sec->reloc_count)
- break;
- loongarch_relax_pcala_addi (abfd, sec, rel, symval);
- }
+ if (0 == info->relax_pass && (i + 4) <= sec->reloc_count)
+ loongarch_relax_pcala_addi (abfd, sec, rel, symval);
break;
case R_LARCH_GOT_PC_HI20:
- if (local_got)
+ if (local_got && 0 == info->relax_pass
+ && (i + 4) <= sec->reloc_count)
{
- if (i + 4 > sec->reloc_count)
- break;
if (loongarch_relax_pcala_ld (abfd, sec, rel))
- {
- loongarch_relax_pcala_addi (abfd, sec, rel, symval);
- }
+ loongarch_relax_pcala_addi (abfd, sec, rel, symval);
}
break;
default:
--
2.36.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 2/5] LoongArch: Directly delete relaxed instuctions, not use R_LARCH_DELETE relocation
2023-10-13 8:24 [PATCH 1/5] LoongArch: Fix ld --no-relax bug mengqinggang
@ 2023-10-13 8:24 ` mengqinggang
2023-10-13 8:24 ` [PATCH 3/5] LoongArch: Multiple relax_trip in one relax_pass mengqinggang
` (2 subsequent siblings)
3 siblings, 0 replies; 10+ messages in thread
From: mengqinggang @ 2023-10-13 8:24 UTC (permalink / raw)
To: binutils
Cc: xuchenghua, chenglulu, liuzhensong, xry111, i.swmail, maskray,
cailulu, mengqinggang
---
bfd/elfnn-loongarch.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c
index 471b5df3a9c..f2da48f3d46 100644
--- a/bfd/elfnn-loongarch.c
+++ b/bfd/elfnn-loongarch.c
@@ -3739,7 +3739,8 @@ loongarch_relax_delete_bytes (bfd *abfd,
/* Relax pcalau12i,addi.d => pcaddi. */
static bool
loongarch_relax_pcala_addi (bfd *abfd, asection *sec,
- Elf_Internal_Rela *rel_hi, bfd_vma symval)
+ Elf_Internal_Rela *rel_hi, bfd_vma symval,
+ struct bfd_link_info *info)
{
bfd_byte *contents = elf_section_data (sec)->this_hdr.contents;
Elf_Internal_Rela *rel_lo = rel_hi + 2;
@@ -3771,8 +3772,9 @@ loongarch_relax_pcala_addi (bfd *abfd, asection *sec,
/* Adjust relocations. */
rel_hi->r_info = ELFNN_R_INFO (ELFNN_R_SYM (rel_hi->r_info),
R_LARCH_PCREL20_S2);
- rel_lo->r_info = ELFNN_R_INFO (ELFNN_R_SYM (rel_hi->r_info),
- R_LARCH_DELETE);
+ rel_lo->r_info = ELFNN_R_INFO (0, R_LARCH_NONE);
+
+ loongarch_relax_delete_bytes (abfd, sec, rel_lo->r_offset, 4, info);
return true;
}
@@ -4004,14 +4006,14 @@ loongarch_elf_relax_section (bfd *abfd, asection *sec,
break;
case R_LARCH_PCALA_HI20:
if (0 == info->relax_pass && (i + 4) <= sec->reloc_count)
- loongarch_relax_pcala_addi (abfd, sec, rel, symval);
+ loongarch_relax_pcala_addi (abfd, sec, rel, symval, info);
break;
case R_LARCH_GOT_PC_HI20:
if (local_got && 0 == info->relax_pass
&& (i + 4) <= sec->reloc_count)
{
if (loongarch_relax_pcala_ld (abfd, sec, rel))
- loongarch_relax_pcala_addi (abfd, sec, rel, symval);
+ loongarch_relax_pcala_addi (abfd, sec, rel, symval, info);
}
break;
default:
--
2.36.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 3/5] LoongArch: Multiple relax_trip in one relax_pass
2023-10-13 8:24 [PATCH 1/5] LoongArch: Fix ld --no-relax bug mengqinggang
2023-10-13 8:24 ` [PATCH 2/5] LoongArch: Directly delete relaxed instuctions, not use R_LARCH_DELETE relocation mengqinggang
@ 2023-10-13 8:24 ` mengqinggang
2023-10-13 8:24 ` [PATCH 4/5] LoongArch: Remove "elf_seg_map (info->output_bfd) == NULL" relaxation condition mengqinggang
2023-10-13 8:24 ` [PATCH 5/5] LoongArch: Modify link_info.relax_pass from 3 to 2 mengqinggang
3 siblings, 0 replies; 10+ messages in thread
From: mengqinggang @ 2023-10-13 8:24 UTC (permalink / raw)
To: binutils
Cc: xuchenghua, chenglulu, liuzhensong, xry111, i.swmail, maskray,
cailulu, mengqinggang
---
bfd/elfnn-loongarch.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c
index f2da48f3d46..47334943fde 100644
--- a/bfd/elfnn-loongarch.c
+++ b/bfd/elfnn-loongarch.c
@@ -3740,7 +3740,7 @@ loongarch_relax_delete_bytes (bfd *abfd,
static bool
loongarch_relax_pcala_addi (bfd *abfd, asection *sec,
Elf_Internal_Rela *rel_hi, bfd_vma symval,
- struct bfd_link_info *info)
+ struct bfd_link_info *info, bool *again)
{
bfd_byte *contents = elf_section_data (sec)->this_hdr.contents;
Elf_Internal_Rela *rel_lo = rel_hi + 2;
@@ -3766,6 +3766,9 @@ loongarch_relax_pcala_addi (bfd *abfd, asection *sec,
|| ((bfd_signed_vma)(symval - pc) > (bfd_signed_vma)(int32_t)0x1ffffc))
return false;
+ /* Continue next relax trip. */
+ *again = true;
+
pca = pcaddi | rd;
bfd_put (32, abfd, pca, contents + rel_hi->r_offset);
@@ -4006,14 +4009,15 @@ loongarch_elf_relax_section (bfd *abfd, asection *sec,
break;
case R_LARCH_PCALA_HI20:
if (0 == info->relax_pass && (i + 4) <= sec->reloc_count)
- loongarch_relax_pcala_addi (abfd, sec, rel, symval, info);
+ loongarch_relax_pcala_addi (abfd, sec, rel, symval, info, again);
break;
case R_LARCH_GOT_PC_HI20:
if (local_got && 0 == info->relax_pass
&& (i + 4) <= sec->reloc_count)
{
if (loongarch_relax_pcala_ld (abfd, sec, rel))
- loongarch_relax_pcala_addi (abfd, sec, rel, symval, info);
+ loongarch_relax_pcala_addi (abfd, sec, rel, symval,
+ info, again);
}
break;
default:
--
2.36.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 4/5] LoongArch: Remove "elf_seg_map (info->output_bfd) == NULL" relaxation condition
2023-10-13 8:24 [PATCH 1/5] LoongArch: Fix ld --no-relax bug mengqinggang
2023-10-13 8:24 ` [PATCH 2/5] LoongArch: Directly delete relaxed instuctions, not use R_LARCH_DELETE relocation mengqinggang
2023-10-13 8:24 ` [PATCH 3/5] LoongArch: Multiple relax_trip in one relax_pass mengqinggang
@ 2023-10-13 8:24 ` mengqinggang
2023-10-19 14:04 ` Xi Ruoyao
2023-10-13 8:24 ` [PATCH 5/5] LoongArch: Modify link_info.relax_pass from 3 to 2 mengqinggang
3 siblings, 1 reply; 10+ messages in thread
From: mengqinggang @ 2023-10-13 8:24 UTC (permalink / raw)
To: binutils
Cc: xuchenghua, chenglulu, liuzhensong, xry111, i.swmail, maskray,
cailulu, mengqinggang
---
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),
--
2.36.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 5/5] LoongArch: Modify link_info.relax_pass from 3 to 2
2023-10-13 8:24 [PATCH 1/5] LoongArch: Fix ld --no-relax bug mengqinggang
` (2 preceding siblings ...)
2023-10-13 8:24 ` [PATCH 4/5] LoongArch: Remove "elf_seg_map (info->output_bfd) == NULL" relaxation condition mengqinggang
@ 2023-10-13 8:24 ` mengqinggang
3 siblings, 0 replies; 10+ messages in thread
From: mengqinggang @ 2023-10-13 8:24 UTC (permalink / raw)
To: binutils
Cc: xuchenghua, chenglulu, liuzhensong, xry111, i.swmail, maskray,
cailulu, mengqinggang
---
bfd/elfnn-loongarch.c | 2 +-
ld/emultempl/loongarchelf.em | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c
index 38a25b63813..4ab6875c7bc 100644
--- a/bfd/elfnn-loongarch.c
+++ b/bfd/elfnn-loongarch.c
@@ -4001,7 +4001,7 @@ loongarch_elf_relax_section (bfd *abfd, asection *sec,
switch (ELFNN_R_TYPE (rel->r_info))
{
case R_LARCH_ALIGN:
- if (2 == info->relax_pass)
+ if (1 == info->relax_pass)
loongarch_relax_align (abfd, sec, sym_sec, info, rel, symval);
break;
case R_LARCH_DELETE:
diff --git a/ld/emultempl/loongarchelf.em b/ld/emultempl/loongarchelf.em
index 4850feb8767..74e95449909 100644
--- a/ld/emultempl/loongarchelf.em
+++ b/ld/emultempl/loongarchelf.em
@@ -42,7 +42,7 @@ larch_elf_before_allocation (void)
ENABLE_RELAXATION;
}
- link_info.relax_pass = 3;
+ link_info.relax_pass = 2;
}
static void
--
2.36.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 4/5] LoongArch: Remove "elf_seg_map (info->output_bfd) == NULL" relaxation condition
2023-10-13 8:24 ` [PATCH 4/5] LoongArch: Remove "elf_seg_map (info->output_bfd) == NULL" relaxation condition mengqinggang
@ 2023-10-19 14:04 ` Xi Ruoyao
2023-10-30 5:14 ` Xi Ruoyao
0 siblings, 1 reply; 10+ messages in thread
From: Xi Ruoyao @ 2023-10-19 14:04 UTC (permalink / raw)
To: mengqinggang, binutils
Cc: xuchenghua, chenglulu, liuzhensong, i.swmail, maskray, cailulu
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),
--
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 4/5] LoongArch: Remove "elf_seg_map (info->output_bfd) == NULL" relaxation condition
2023-10-19 14:04 ` Xi Ruoyao
@ 2023-10-30 5:14 ` Xi Ruoyao
2023-10-30 8:00 ` mengqinggang
0 siblings, 1 reply; 10+ messages in thread
From: Xi Ruoyao @ 2023-10-30 5:14 UTC (permalink / raw)
To: mengqinggang, binutils
Cc: xuchenghua, chenglulu, liuzhensong, i.swmail, maskray, cailulu
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),
>
--
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 4/5] LoongArch: Remove "elf_seg_map (info->output_bfd) == NULL" relaxation condition
2023-10-30 5:14 ` Xi Ruoyao
@ 2023-10-30 8:00 ` mengqinggang
2023-11-16 0:03 ` Xi Ruoyao
0 siblings, 1 reply; 10+ messages in thread
From: mengqinggang @ 2023-10-30 8:00 UTC (permalink / raw)
To: Xi Ruoyao, binutils
Cc: xuchenghua, chenglulu, liuzhensong, i.swmail, maskray, cailulu
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),
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 4/5] LoongArch: Remove "elf_seg_map (info->output_bfd) == NULL" relaxation condition
2023-10-30 8:00 ` mengqinggang
@ 2023-11-16 0:03 ` Xi Ruoyao
2023-11-16 2:06 ` mengqinggang
0 siblings, 1 reply; 10+ messages in thread
From: Xi Ruoyao @ 2023-11-16 0:03 UTC (permalink / raw)
To: mengqinggang, binutils
Cc: xuchenghua, chenglulu, liuzhensong, i.swmail, maskray, cailulu
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),
>
--
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 4/5] LoongArch: Remove "elf_seg_map (info->output_bfd) == NULL" relaxation condition
2023-11-16 0:03 ` Xi Ruoyao
@ 2023-11-16 2:06 ` mengqinggang
0 siblings, 0 replies; 10+ messages in thread
From: mengqinggang @ 2023-11-16 2:06 UTC (permalink / raw)
To: Xi Ruoyao, binutils
Cc: xuchenghua, chenglulu, liuzhensong, i.swmail, maskray, cailulu
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),
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2023-11-16 2:07 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-13 8:24 [PATCH 1/5] LoongArch: Fix ld --no-relax bug mengqinggang
2023-10-13 8:24 ` [PATCH 2/5] LoongArch: Directly delete relaxed instuctions, not use R_LARCH_DELETE relocation mengqinggang
2023-10-13 8:24 ` [PATCH 3/5] LoongArch: Multiple relax_trip in one relax_pass mengqinggang
2023-10-13 8:24 ` [PATCH 4/5] LoongArch: Remove "elf_seg_map (info->output_bfd) == NULL" relaxation condition mengqinggang
2023-10-19 14:04 ` Xi Ruoyao
2023-10-30 5:14 ` Xi Ruoyao
2023-10-30 8:00 ` mengqinggang
2023-11-16 0:03 ` Xi Ruoyao
2023-11-16 2:06 ` mengqinggang
2023-10-13 8:24 ` [PATCH 5/5] LoongArch: Modify link_info.relax_pass from 3 to 2 mengqinggang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).