This is an archive of the discontinued LLVM Phabricator instance.

[LLD][ELF][AArch64] Simplify relocations sharing same encoding [NFC]
ClosedPublic

Authored by peter.smith on Apr 30 2018, 1:48 AM.

Details

Summary

The code to encode the result in relocateOne for the relocations:
R_AARCH64_LD64_GOT_LO12_NC
R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC
R_AARCH64_TLSDESC_LD64_LO12

is equivalent to that for R_AARCH64_LDST64_ABS_LO12_NC. This is described in the ABI as "Set the LD/ST immediate field bits [11:3] of X. No overflow check; check that X&7 =0." This is a simple refactoring change to combine into one case.

Diff Detail

Repository
rLLD LLVM Linker

Event Timeline

peter.smith created this revision.Apr 30 2018, 1:48 AM
grimar accepted this revision.May 3 2018, 2:28 AM
grimar added a subscriber: grimar.

LGTM.

(It was a bit unobvious, but I agree that or32AArch64Imm(Loc, getBits(Val, 3, 11)) is an equivalent for or32le(Loc, (Val & 0xFF8) << 7).)

This revision is now accepted and ready to land.May 3 2018, 2:28 AM
This revision was automatically updated to reflect the committed changes.