This is an archive of the discontinued LLVM Phabricator instance.

[LLD][ELF][AArch64] Do not use thunk for undefined weak symbol.
ClosedPublic

Authored by peter.smith on Jan 6 2020, 6:48 AM.

Details

Summary

In AArch64 a branch to an undefined weak symbol that does not have a PLT entry should resolve to the next instruction. The thunk generation code can prevent this from happening as a range extension thunk can be generated if the branch is sufficiently far away from 0, the value of an undefined weak symbol. The fix is taken from the Arm implementation of needsThunk(), we prevent a thunk from being generated to an undefined weak symbol. The tests for both Arm and AArch64 undefined weak have been updated to use a higher address that would detect the original problem reported in pr44451

fixes pr44451

Diff Detail

Event Timeline

peter.smith created this revision.Jan 6 2020, 6:48 AM
MaskRay accepted this revision.Jan 6 2020, 5:37 PM
This revision is now accepted and ready to land.Jan 6 2020, 5:37 PM
This revision was automatically updated to reflect the committed changes.