llvm-project/lld/ELF/Arch
Peter Smith 28b172e341 [LLD][ELF][ARM] Implement ARM pc-relative relocations for ADR and LDR
The R_ARM_ALU_PC_G0 and R_ARM_LDR_PC_G0 relocations are used by the
ADR and LDR pseudo instructions, and are the basis of the group
relocations that can load an arbitrary constant via a series of add, sub
and ldr instructions.

The relocations need to be obtained via the .reloc directive.

R_ARM_ALU_PC_G0 is much more complicated as the add/sub instruction uses
a modified immediate encoding of an 8-bit immediate rotated right by an
even 4-bit field. This means that the range of representable immediates
is sparse. We extract the encoding and decoding functions for the modified
immediate from llvm/lib/Target/ARM/MCTargetDesc/ARMAddressingModes.h as
this header file is not accessible from LLD. Duplication of code isn't
ideal, but as these are well-defined mathematical functions they are
unlikely to change.

Differential Revision: https://reviews.llvm.org/D75349
2020-04-08 12:43:44 +01:00
..
AArch64.cpp [LLD][ELF][AArch64] Change the semantics of -z pac-plt. 2020-02-18 09:56:57 +01:00
AMDGPU.cpp [ELF] Rename relocateOne() to relocate() and pass `Relocation` to it 2020-01-25 12:00:18 -08:00
ARM.cpp [LLD][ELF][ARM] Implement ARM pc-relative relocations for ADR and LDR 2020-04-08 12:43:44 +01:00
AVR.cpp [ELF] Rename relocateOne() to relocate() and pass `Relocation` to it 2020-01-25 12:00:18 -08:00
Hexagon.cpp [LLD][ELF][Hexagon] Support GDPLT transforms 2020-03-13 11:02:11 -05:00
MSP430.cpp [ELF] Rename relocateOne() to relocate() and pass `Relocation` to it 2020-01-25 12:00:18 -08:00
Mips.cpp [ELF] Rename relocateOne() to relocate() and pass `Relocation` to it 2020-01-25 12:00:18 -08:00
MipsArchTree.cpp [ELF] Wrap things in `namespace lld { namespace elf {`, NFC 2019-10-07 08:31:18 +00:00
PPC.cpp [ELF][PPC32] Fix canonical PLTs when the order does not match the PLT order 2020-02-28 22:23:14 -08:00
PPC64.cpp [lld] NFC: fix trivial typos in comments 2020-04-02 01:21:36 +09:00
RISCV.cpp [ELF][RISCV] Add R_RISCV_IRELATIVE 2020-02-10 20:22:39 -08:00
SPARCV9.cpp [ELF] Rename relocateOne() to relocate() and pass `Relocation` to it 2020-01-25 12:00:18 -08:00
X86.cpp [ELF] Rename relocateOne() to relocate() and pass `Relocation` to it 2020-01-25 12:00:18 -08:00
X86_64.cpp LLD Support for Basic Block Sections 2020-04-07 06:55:57 -07:00