This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Do not add the relocation addend to the instruction encoding
ClosedPublic

Authored by stefanp on Jun 3 2020, 4:22 AM.

Details

Summary

We should not be adding the relocation addend to the instruction encoding.
This patch removes that and sets those bits to zero.

Diff Detail

Event Timeline

stefanp created this revision.Jun 3 2020, 4:22 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 3 2020, 4:22 AM

Do you already have a test which dumps the relocations and verifies the addend on the relocations? (Do the llvm tools support dumping these new relocations?)

llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCCodeEmitter.cpp
224

I think you are better keeping the return here.

259

ditto.

stefanp updated this revision to Diff 269386.EditedJun 8 2020, 5:58 PM

I've put the return instructions back in place.
The test in this patch already prints out the addend. The CHECK-O section prints out the relocation and then it has symbol+<addend>. Is that what you are looking for?
For example:

; CHECK-O-NEXT:    0000000000000000:  R_PPC64_PCREL34      array2+0x1c
sfertile accepted this revision as: sfertile.Jun 11 2020, 8:46 AM

LGTM.

The CHECK-O section prints out the relocation and then it has symbol+<addend>. Is that what you are looking for?

Yeah, not sure how I missed that the first time. Sorry.

This revision is now accepted and ready to land.Jun 11 2020, 8:46 AM
NeHuang accepted this revision as: NeHuang.Jun 12 2020, 8:17 AM
NeHuang added a subscriber: NeHuang.

LGTM

This revision was automatically updated to reflect the committed changes.