This is an archive of the discontinued LLVM Phabricator instance.

[BOLT] Add support for GOTPCRELX relocations
ClosedPublic

Authored by maksfb on May 31 2022, 6:24 PM.

Details

Summary

The linker can convert instructions with GOTPCRELX relocations into a
form that uses an absolute addressing with an immediate. BOLT needs to
recognize such conversions and symbolize the immediates.

Diff Detail

Event Timeline

maksfb created this revision.May 31 2022, 6:24 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 31 2022, 6:24 PM
Herald added subscribers: jsji, pengfei. · View Herald Transcript
maksfb requested review of this revision.May 31 2022, 6:24 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 31 2022, 6:24 PM
rafauler accepted this revision.Jun 1 2022, 7:29 PM

Thanks! LGTM pending the test fix

bolt/lib/Target/X86/X86MCSymbolizer.cpp
91

If the operand if PC-relative -> If the operand is PC-relative

This revision is now accepted and ready to land.Jun 1 2022, 7:29 PM
maksfb added a comment.Jun 6 2022, 6:26 PM

Currently blocked on having trunk-built LLD available for pre-merge checks: https://github.com/google/llvm-premerge-checks/issues/401. The system LLD does not properly support --no-relax option.

maksfb added a subscriber: MaskRay.Jun 6 2022, 6:26 PM
MaskRay added inline comments.Jun 6 2022, 7:34 PM
bolt/lib/Core/Relocation.cpp
568
maksfb updated this revision to Diff 434895.Jun 7 2022, 11:09 AM

Address comments.

maksfb marked 2 inline comments as done.Jun 7 2022, 11:45 AM
Amir added a comment.Jun 9 2022, 1:19 PM

Currently blocked on having trunk-built LLD available for pre-merge checks: https://github.com/google/llvm-premerge-checks/issues/401. The system LLD does not properly support --no-relax option.

Should be unblocked now as pre-merge checks should now use lld build from trunk: https://github.com/google/llvm-premerge-checks/issues/401
Retriggered pre-merge checks which came back clean.

This revision was automatically updated to reflect the committed changes.
maksfb added a comment.Jun 9 2022, 1:46 PM

Currently blocked on having trunk-built LLD available for pre-merge checks: https://github.com/google/llvm-premerge-checks/issues/401. The system LLD does not properly support --no-relax option.

Should be unblocked now as pre-merge checks should now use lld build from trunk: https://github.com/google/llvm-premerge-checks/issues/401
Retriggered pre-merge checks which came back clean.

Great. Thank you.