[PATCH v2] LoongArch: Add overflow check and new relaxations when relaxing pcalau12i+ld.d

Xi Ruoyao xry111@xry111.site
Fri Nov 15 06:13:06 GMT 2024


On Fri, 2024-11-15 at 10:51 +0800, Lulu Cai wrote:
> For pcalau12i+ld.d that can be relaxed, the relaxation is
> pcalau12i+ld.d => pcalau12i+addi.d => pcaddi and there is no
> overflow check.
> 
> So the overflow check in the pcalau12i+ld.d relaxation and the
> relaxation of pcalau12i+ld.d => pcaddi are added.
> 
> Changes from v1:
>   * Add relaxation for pcalau12i+ld.d=>pcaddi.

Why do we need this?

/* snip */

> -      if (relax_func (abfd, sec, sym_sec, rel, symval,
> -		      info, again, max_alignment)
> -	  && relax_func == loongarch_relax_pcala_ld)
> -	loongarch_relax_pcala_addi (abfd, sec, sym_sec, rel, symval,
> -				    info, again, max_alignment);

If pcalau12i + ld.d can be relaxed to pcaddi, here the pair will be
relaxed to pcalau12i + addi.d by loongarch_relax_pcala_ld and then
further relaxed to pcaddi anyway.

-- 
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University


More information about the Binutils mailing list