[PATCH 1/5 v1] LoongArch: bfd: Add new reloc types.
Xi Ruoyao
xry111@xry111.site
Mon Jul 18 11:33:46 GMT 2022
On Mon, 2022-07-18 at 18:06 +0800, WANG Xuerui wrote:
> (Adding Ruoyao and MaskRay to CC, who might be interested in this
> development as well, as it concerns the linker implementation.)
I've already subscribed binutils@sourceware.org in order not to be
passed by.
> I think I've voiced my concerns over the naming of these ops multiple
> times already; the primary comment ([1]; in English) was posted back in
> May but no one in your team responded.
>
> Reproducing the content (and adjusting a little) here:
>
>
> Overall in a good direction (and IMHO the direction everyone should have
> taken in the first place), thanks!
>
Yes, we've been paying additional costs using those "stack based
relocation". I'd like to know why they were proposed in first place?
(Not accusing anyone, just my curiosity: AFAIK no other targets ever
used such a stack for relocation.)
/* snip */
> FYI, I did make a list of my suggested names for these reloc types
> ("BFD_RELOC_LARCH_" abbreviated to "B_R_L_"):
>
> Original name Suggested name
> ------------- --------------
> B_R_L_B16 B_R_L_PCREL_SK16 *1
> B_R_L_B21 B_R_L_PCREL_SD5K16
> B_R_L_B26 B_R_L_PCREL_SD10K16
> B_R_L_ABS_LO12 B_R_L_ABS_0_SK12
> B_R_L_ABS_HI20 B_R_L_ABS_12_SJ20
> B_R_L_ABS64_LO20 B_R_L_ABS_32_SJ20
> B_R_L_ABS64_HI12 B_R_L_ABS_52_SK12
> B_R_L_PCALA_LO12 B_R_L_PCALA_0_SK12 *2
> B_R_L_PCALA_HI20 B_R_L_PCALA_12_SJ20
> B_R_L_PCALA64_LO20 B_R_L_PCALA_32_SJ20 *3
> B_R_L_PCALA64_HI12 B_R_L_PCALA_52_SK12
> B_R_L_GOT_PC_LO12 B_R_L_GOT_PCALA_0_SK12 *4
> B_R_L_GOT_PC_HI20 B_R_L_GOT_PCALA_12_SJ20
> B_R_L_GOT64_PC_LO20 B_R_L_GOT_PCALA_32_SJ20
> B_R_L_GOT64_PC_HI12 B_R_L_GOT_PCALA_52_SK12
> B_R_L_GOT64_LO12 B_R_L_GOT_ABS_0_SK12 *5
> B_R_L_GOT64_HI20 B_R_L_GOT_ABS_12_SJ20
> B_R_L_GOT64_LO20 B_R_L_GOT_ABS_32_SJ20
> B_R_L_GOT64_HI12 B_R_L_GOT_ABS_52_SK12
> B_R_L_TLS_LE_LO12 B_R_L_TLS_LE_ABS_0_SK12
> B_R_L_TLS_LE_HI20 B_R_L_TLS_LE_ABS_12_SJ20
> B_R_L_TLS_LE64_LO20 B_R_L_TLS_LE_ABS_32_SJ20
> B_R_L_TLS_LE64_HI12 B_R_L_TLS_LE_ABS_52_SK12
> B_R_L_TLS_IE_PC_LO12 B_R_L_TLS_IE_PCALA_0_SK12
> B_R_L_TLS_IE_PC_HI20 B_R_L_TLS_IE_PCALA_12_SJ20
> B_R_L_TLS_IE64_PC_LO20 B_R_L_TLS_IE_PCALA_32_SJ20
> B_R_L_TLS_IE64_PC_HI12 B_R_L_TLS_IE_PCALA_52_SK12
> B_R_L_TLS_IE64_LO12 B_R_L_TLS_IE_ABS_0_SK12
> B_R_L_TLS_IE64_HI20 B_R_L_TLS_IE_ABS_12_SJ20
> B_R_L_TLS_IE64_LO20 B_R_L_TLS_IE_ABS_32_SJ20
> B_R_L_TLS_IE64_HI12 B_R_L_TLS_IE_ABS_52_SK12
> B_R_L_TLS_LD_PC_HI20 B_R_L_TLS_LD_PCALA_12_SJ20 *6
> B_R_L_TLS_LD64_HI20 B_R_L_TLS_LD_ABS_12_SJ20
> B_R_L_TLS_GD_PC_HI20 B_R_L_TLS_GD_PCALA_12_SJ20
> B_R_L_TLS_GD64_HI20 B_R_L_TLS_GD_ABS_12_SJ20
It's overall better, but those "J, K" etc are cryptic IMHO. And for
"B_R_L_B16" I think "B_R_L_PCREL_SK16" fails to express that the offset
should be shifted right by 2, so I'd keep B_R_L_B16 (and similarly,
B_R_L_B21 and B_R_L_B26) like the PCALA case.
--
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University
More information about the Binutils
mailing list