This is an archive of the discontinued LLVM Phabricator instance.

[LLD][ARM] Add R_ARM_RELATIVE to relocations that can be applied to GotSection
ClosedPublic

Authored by peter.smith on Dec 12 2016, 9:26 AM.

Details

Summary

When compiling -fpie and linking with the --pie option the R_ARM_GOTBREL relocation to D is resolved by writing the value of D into the .got slot and emitting an R_ARM_RELATIVE relocation for it.

Unfortunately R_ARM_RELATIVE is missing from relocateOne() leading to an unsupported relocation error (and then a segfault by the error handling system as it tries to look up the source for the GotSection.

The simple fix is to add R_ARM_RELATIVE to relocateOne() as R_ABS.

The R_ARM_GOTBREL relocation is present in the glibc library startup code so this problem will affect all --pie applications.

Diff Detail

Repository
rL LLVM

Event Timeline

peter.smith retitled this revision from to [LLD][ARM] Add R_ARM_RELATIVE to relocations that can be applied to GotSection.
peter.smith updated this object.
peter.smith added reviewers: ruiu, rafael.
peter.smith added a subscriber: llvm-commits.
ruiu accepted this revision.Dec 12 2016, 10:48 AM
ruiu edited edge metadata.

LGTM

This revision is now accepted and ready to land.Dec 12 2016, 10:48 AM
This revision was automatically updated to reflect the committed changes.