This is an archive of the discontinued LLVM Phabricator instance.

[ELF][ARM] Refine check for when undefined weak needs a Thunk
ClosedPublic

Authored by peter.smith on Nov 20 2017, 6:50 AM.

Details

Summary

When an undefined weak reference has a PLT entry we must generate a range extension thunk for any B or BL that can't reach the PLT entry.

This change explicitly looks for whether a PLT entry exists rather than assuming that weak references never need PLT entries unless Config->Shared is in operation. This covers the case where we are linking an executable with dynamic linking, hence a PLT entry will be needed for undefined weak references. This case comes up in real programs over 32 Mb in size as there is a B to a weak reference gmonstart__ in the Arm crti.o for glibc.

Discovered while linking chrome on arm, error message: /usr/lib/../lib/crti.o:(.text+0x18): relocation R_ARM_JUMP24 out of range

Diff Detail

Repository
rL LLVM

Event Timeline

peter.smith created this revision.Nov 20 2017, 6:50 AM
This revision was automatically updated to reflect the committed changes.