Page MenuHomePhabricator

[LLD][ELF][AArch64] Support for movz, movk tprel relocations

Authored by peter.smith on Aug 7 2019, 8:15 AM.



This patch Implements the R_AARCH64_TLSLE_MOVW_TPREL_G*[_NC]. These are logically the same calculation as the existing TLSLE relocations with the result written back to mov[nz] and movk instructions. A typical code sequence is:

movz x0, #:tprel_g2:foo       // bits [47:32] of R_TLS with overflow check
movk x0, #:tprel_g1_nc:foo // bits [31:16] of R_TLS with no overflow check
movk x0, #:tprel_g0_nc:foo // bits [15:0] of R_TLS with no overflow check

This type of code sequence is usually used with a large code model.

fixes PR42853

We also do not yet support the :dtprel_g*: and :gottprel_g*: associated with local dynamic and initial exec. These can be added in separate patches as they may need some thought over how to deal with relaxation. The tprel relocations are already local exec so can't be relaxed further.

Diff Detail


Event Timeline

peter.smith created this revision.Aug 7 2019, 8:15 AM
MaskRay added a reviewer: pcc.Aug 7 2019, 7:19 PM

Looks good to me. Some nits of the test:

27 ↗(On Diff #213890)

The address can be omitted. The encoding bytes may be omitted, too (--no-show-raw-insn).

Probably make all instruction CHECK: lines CHECK-NEXT:. I think they are contiguous.

40 ↗(On Diff #213890)

(Or use llvm-nm %t | FileCheck ... to make it concise :)

ruiu accepted this revision.Aug 8 2019, 12:53 AM


This revision is now accepted and ready to land.Aug 8 2019, 12:53 AM

Thanks for the review, I've applied the changes to the test prior to commit.

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptAug 8 2019, 6:38 AM