public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [Binutils][AARCH64][0/2]Add group relocations to create PC-relative offset.
@ 2018-01-18 15:34 Renlin Li
  2018-01-18 15:38 ` [Binutils][AARCH64][1/2]Add " Renlin Li
  2018-01-18 15:39 ` [Binutils][AARCH64][2/2]Add " Renlin Li
  0 siblings, 2 replies; 6+ messages in thread
From: Renlin Li @ 2018-01-18 15:34 UTC (permalink / raw)
  To: binutils, Ramana Radhakrishnan, Nicholas Clifton

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-01-24 16:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-18 15:34 [Binutils][AARCH64][0/2]Add group relocations to create PC-relative offset Renlin Li
2018-01-18 15:38 ` [Binutils][AARCH64][1/2]Add " Renlin Li
2018-01-22 13:22   ` Nick Clifton
2018-01-18 15:39 ` [Binutils][AARCH64][2/2]Add " Renlin Li
2018-01-22 13:24   ` Nick Clifton
2018-01-24 16:20     ` Renlin Li

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).