[lld] [ELF/AArch64] Fix R_AARCH64_ABS64 in Shared mode
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Tue, 23 Feb 2016 16:54:40 +0000 (16:54 +0000)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Tue, 23 Feb 2016 16:54:40 +0000 (16:54 +0000)
commit668ad0ffcb49ec04beede54d07652f4dc538fd0f
treeabc79bfba492afce818c9722675bf7e823ebc515
parenta1c6269c91a0946d9a7314944dedecf26c0a594e
[lld] [ELF/AArch64] Fix R_AARCH64_ABS64 in Shared mode

This patch fixes the R_AARCH64_ABS64 relocation when used in shared mode,
where it requires a dynamic R_AARCH64_RELATIVE relocation. To correct set
the addend on the dynamic relocation (since it will be used by the dynamic
linker), a new TargetInfo specific hook was created (getDynRelativeAddend)
to get the correct addend based on relocation type.

The patch fixes the issues when creating shared library code against
{init,fini}_array, where it issues R_AARCH64_ABS64 relocation against
local symbols.

llvm-svn: 261651
lld/ELF/OutputSections.cpp
lld/ELF/OutputSections.h
lld/ELF/Target.cpp
lld/ELF/Writer.cpp
lld/test/ELF/aarch64-abs64-dyn.s [new file with mode: 0644]