This is an archive of the discontinued LLVM Phabricator instance.

Relax relocation type checking in a non-ALLOC section.
ClosedPublic

Authored by ruiu on Feb 15 2018, 1:24 PM.

Details

Summary

Even though it doesn't make sense, there seems to be multiple programs
in the wild that create PC-relative relocations in non-ALLOC sections.
This is caused by the negligence of GNU linkers to not report any errors
for such relocations.

Currently, lld emits warnings against such relocations and exits.
So, you cannot link any program that contains wrong relocations until
you fix an issue in a program that generates wrong ELF files. It's often
impractical because it isn't always easy to fix a problem in a ELF-
generating program.

This patch relaxes the error checking and emit a warning instead.

Diff Detail

Repository
rL LLVM

Event Timeline

ruiu created this revision.Feb 15 2018, 1:24 PM
ruiu updated this revision to Diff 134502.Feb 15 2018, 1:46 PM
  • fix typos in test
ruiu updated this revision to Diff 134526.Feb 15 2018, 4:17 PM
  • updated as per Rafael's comment
ruiu updated this revision to Diff 134527.Feb 15 2018, 4:19 PM
  • early continue
ruiu updated this revision to Diff 134530.Feb 15 2018, 4:30 PM
  • address a review comment
ruiu updated this revision to Diff 134531.Feb 15 2018, 4:43 PM
  • keep reporting errors if not R_ABS nor R_PC
  • restore the original test for an unknown relocation type
This revision was not accepted when it landed; it landed in state Needs Review.Feb 15 2018, 5:15 PM
This revision was automatically updated to reflect the committed changes.