[ELF][AArch64] Fix adrp to undefined weak reference.
authorPeter Smith <peter.smith@linaro.org>
Thu, 13 Dec 2018 11:13:01 +0000 (11:13 +0000)
committerPeter Smith <peter.smith@linaro.org>
Thu, 13 Dec 2018 11:13:01 +0000 (11:13 +0000)
commitfe3015d1642db94edb8b953fa2b98704930cc477
tree0e268b67f8fe2727e23d1746746f3d019fc8918d
parent919f5fb8ca5f24ec791725a498b0e37fa70bc55a
[ELF][AArch64] Fix adrp to undefined weak reference.

In the ABI for the 64-bit Arm architecture the section on weak references
states:
During linking, the symbol value of an undefined weak reference is:
- Zero if the relocation type is absolute
- The address of the place if the relocation type is pc-relative.

The relocations associated with an ADRP are relative so we should resolve
the undefined weak reference to the place instead of 0. This matches GNU
ld.bfd behaviour.

fixes pr34928

Differential Revision: https://reviews.llvm.org/D55599

llvm-svn: 349024
lld/ELF/InputSection.cpp
lld/test/ELF/aarch64-undefined-weak.s