[PATCH v2 2/6] LoongArch:opcodes: Add new reloc types.
liuzhensong
liuzhensong@loongson.cn
Thu Jul 21 08:26:28 GMT 2022
在 2022/7/21 下午3:51, Xi Ruoyao 写道:
> On Thu, 2022-07-21 at 14:02 +0800, liuzhensong wrote:
>
>> It seems default for addi.d/ld.d to access extreme address.
>> Simple example of abs32:
>> address range of abs32 : 0~0xffffffff
>> sym address: 0xfffff800
>> lui12.w $rd, 0xfffff
>> ori $rd, $d, 0x800
>> $rd is 0xfffff800
>> Obviously, lu12i.w and addi.w/ld.w can not get address > 0xfffff7fc
> Hmm... Wouldn't "addi.{w/d} $t0, $zero, -0x800" work for this?
>
>
This can be do in ld relax rather than as.
+#define INSN_LA_ABS64 \
+ "lu12i.w %1,%%abs_hi20(%2);" \
+ "ori %1,%1,%%abs_lo12(%2);" \
+ "lu32i.d %1,%%abs64_lo20(%2);" \
+ "lu52i.d %1,%1,%%abs64_hi12(%2);", \
+ &LARCH_opts.ase_lp64, 0
More information about the Binutils
mailing list