This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[Binutils][AARCH64][0/2]Add group relocations to create PC-relative offset.
- From: Renlin Li <renlin dot li at foss dot arm dot com>
- To: "binutils at sourceware dot org" <binutils at sourceware dot org>, Ramana Radhakrishnan <Ramana dot Radhakrishnan at arm dot com>, Nicholas Clifton <nickc at redhat dot com>
- Date: Thu, 18 Jan 2018 15:34:10 +0000
- Subject: [Binutils][AARCH64][0/2]Add group relocations to create PC-relative offset.
- Authentication-results: sourceware.org; auth=none
Hi all,
This is a patch to add Group relocations to create a
16, 32, 48, or 64 bit PC-relative offset inline.
The following relocations are added along with the test cases:
BFD_RELOC_AARCH64_MOVW_PREL_G0, BFD_RELOC_AARCH64_MOVW_PREL_G0_NC,
BFD_RELOC_AARCH64_MOVW_PREL_G1, BFD_RELOC_AARCH64_MOVW_PREL_G1_NC,
BFD_RELOC_AARCH64_MOVW_PREL_G2, BFD_RELOC_AARCH64_MOVW_PREL_G2_NC,
BFD_RELOC_AARCH64_MOVW_PREL_G3.
The operations for those relocations are: S + A - P.
S is the address of the symbol.
A is the addend for the relocation.
P is the address of the place being relocated
Those relocations are used to create PC-relative offset. For example,
The following code sequence could get the full address of _start.
.Ltmp1:
movz x0, :prel_g2: _start - .Ltmp1
movk x0, :prel_g1_nc: _start - .Ltmp1
movk x0, :prel_g0_nc: _start - .Ltmp1
adr x1, .Ltmp1
add x0, x0, x1
binutils regression test checked OK, linux kernel link checked OK.
OK to commit?
Regards,
Renlin