This is an archive of the discontinued LLVM Phabricator instance.

[LLD][ELF][AArch64] Fix ADRP relocations to undefined weak reference.
ClosedPublic

Authored by peter.smith on Dec 12 2018, 6:13 AM.

Details

Summary

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 (https://bugs.llvm.org/show_bug.cgi?id=34928)

Diff Detail

Repository
rL LLVM

Event Timeline

peter.smith created this revision.Dec 12 2018, 6:13 AM
grimar accepted this revision.Dec 12 2018, 6:39 AM

LGTM, thanks!

This revision is now accepted and ready to land.Dec 12 2018, 6:39 AM
This revision was automatically updated to reflect the committed changes.