This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC][LLD] Change PPC64R2SaveStub to only use non-PC-relative code
ClosedPublic

Authored by stefanp on Jul 12 2022, 11:29 AM.

Details

Summary

Currently the PPC64R2SaveStub thunk will produce Power 10 code by default.
This produced an issue when linking older code that made use of the st_other=1
bit but was never meant to be linked or run on Power 10.

This patch makes it so that only the R_PPC64_REL24_NOTOC relocation can produce
Power 10 code.

Diff Detail

Event Timeline

stefanp created this revision.Jul 12 2022, 11:29 AM
Herald added a project: Restricted Project. · View Herald Transcript
stefanp requested review of this revision.Jul 12 2022, 11:29 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 12 2022, 11:29 AM
Herald added a subscriber: StephenFan. · View Herald Transcript
stefanp added a reviewer: Restricted Project.Jul 12 2022, 11:30 AM

LG.

[PowerPC][LLD] Change the behavior of the PPC64R2SaveStub thunk.

"Change the behavior" isn't descriptive. Just use a brief sentence to describe what has changed, e.g. "Change PPC64R2SaveStub to only use non-PC-relative code"

lld/test/ELF/ppc64-toc-call-to-pcrel-long-jump.s
16

Remove --mcpu=pwr10 since llvm-objdump now defaults to --mcpu=future for ppc64.

stefanp retitled this revision from [PowerPC][LLD] Change the behavior of the PPC64R2SaveStub thunk. to [PowerPC][LLD] Change PPC64R2SaveStub to only use non-PC-relative code.Jul 13 2022, 9:05 AM
stefanp updated this revision to Diff 444307.Jul 13 2022, 9:31 AM

Rebased the patch to top of trunk.
Fixed up test case to remove the mcpu=pwr10.

MaskRay accepted this revision.Jul 13 2022, 10:10 AM

When lld added the R2 Save Stub to that code at link time previous code that was runable on Power 8 now included Power 10 code.

This sentence in the summary seems unclear. The previous sentence has explained that the code caused some issue.
Consider removing it or clarifying it.

This revision is now accepted and ready to land.Jul 13 2022, 10:10 AM
stefanp edited the summary of this revision. (Show Details)Jul 13 2022, 11:51 AM

When lld added the R2 Save Stub to that code at link time previous code that was runable on Power 8 now included Power 10 code.

This sentence in the summary seems unclear. The previous sentence has explained that the code caused some issue.
Consider removing it or clarifying it.

I've removed the unclear sentence.

Thank you for the very quick review!

stefanp updated this revision to Diff 444471.Jul 13 2022, 5:34 PM

Rebased patch to top of main.

This revision was landed with ongoing or failed builds.Jul 13 2022, 5:34 PM
This revision was automatically updated to reflect the committed changes.