Page MenuHomePhabricator

[PowerPC] Fix missing nop after call to weak callee.

Authored by stefanp on Nov 23 2020, 10:54 AM.



Weak functions can be replaced by other functions at link time. Previously it
was assumed that no matter what the weak callee function was replaced with it
would still share the same TOC as the caller. This is no longer true as a weak
callee with a TOC setup can be replaced by another function that was compiled
with PC Relative and does not have a TOC at all.

This patch makes sure that all calls to functions defined as weak from a caller
that has a valid TOC have a nop after the call to allow a place for the linker
to restore the TOC.

Diff Detail

Event Timeline

stefanp created this revision.Nov 23 2020, 10:54 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 23 2020, 10:54 AM
stefanp requested review of this revision.Nov 23 2020, 10:54 AM
stefanp added a reviewer: Restricted Project.Nov 23 2020, 10:54 AM
NeHuang added inline comments.Nov 26 2020, 12:30 PM

nit code models


Should we put a CHECK-NEXT here


should we put a CHECK-NEXT here?

stefanp updated this revision to Diff 308730.Dec 1 2020, 12:01 PM

Updated test cases according to review.

amyk added a subscriber: amyk.Dec 3 2020, 7:49 AM
amyk added inline comments.

CHECK-NEXT here, too?

stefanp updated this revision to Diff 309973.Dec 7 2020, 11:36 AM

Added CHECK-NEXT that was missed.

NeHuang accepted this revision as: NeHuang.Dec 7 2020, 1:40 PM


This revision is now accepted and ready to land.Dec 7 2020, 1:40 PM
This revision was landed with ongoing or failed builds.Dec 8 2020, 7:39 AM
This revision was automatically updated to reflect the committed changes.