This is an archive of the discontinued LLVM Phabricator instance.

[JITLink][PowerPC] Fix incorrect assertion of addend for R_PPC64_REL24
ClosedPublic

Authored by lkail on Aug 23 2023, 11:52 PM.

Details

Summary

There is case that R_PPC64_REL24 with non-zero addend. The assertion is incorrectly triggered in such situation.

Diff Detail

Event Timeline

lkail created this revision.Aug 23 2023, 11:52 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 23 2023, 11:52 PM
lkail requested review of this revision.Aug 23 2023, 11:52 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 23 2023, 11:52 PM
lkail updated this revision to Diff 553028.Aug 24 2023, 1:09 AM
lkail updated this revision to Diff 553029.
lkail added reviewers: Restricted Project, lhames, MaskRay.

@lkail the test you precommited (https://reviews.llvm.org/rG4468103bf68ce09820d0e31fa7c725004b5f2ca4) for this change is failing on Darwin -

https://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental/37181/

# CHECK: Assertion `Addend == 0 && "Addend is expected to be 0 for a function call"' failed
         ^
<stdin>:1:1: note: scanning from here
Assertion failed: (Addend == 0 && "Addend is expected to be 0 for a function call"), function addSingleRelocation, file /Users/buildslave/jenkins/workspace/clang-stage1-cmake-RA-incremental/llvm-project/llvm/lib/ExecutionEngine/JITLink/ELF_ppc64.cpp, line 349.
^

Input file: <stdin>
Check file: /Users/buildslave/jenkins/workspace/clang-stage1-cmake-RA-incremental/llvm-project/llvm/test/ExecutionEngine/JITLink/ppc64/ppc64-rel24-non-zero-addend.test

-dump-input=help explains the following input dump.

Input was:
<<<<<<
         1: Assertion failed: (Addend == 0 && "Addend is expected to be 0 for a function call"), function addSingleRelocation, file /Users/buildslave/jenkins/workspace/clang-stage1-cmake-RA-incremental/llvm-project/llvm/lib/ExecutionEngine/JITLink/ELF_ppc64.cpp, line 349. 
check:4     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found

I will revert the precommitted test.

lkail added a comment.Aug 27 2023, 9:29 PM

@arphaman Thanks for reverting this.

lkail planned changes to this revision.Aug 27 2023, 9:31 PM
This comment was removed by lkail.
lkail updated this revision to Diff 553849.Aug 27 2023, 11:56 PM

@lkail Were you able to determine what caused the issue on Darwin? I haven't had a chance to check it out yet.

lkail added a comment.Aug 28 2023, 6:58 PM

@lkail Were you able to determine what caused the issue on Darwin? I haven't had a chance to check it out yet.

The assertion message on Darwin is

Assertion failed: (Addend == 0 && "Addend is expected to be 0 for a function call"), function addSingleRelocation,

While the culprit commit checks

Assertion `Addend == 0 && "Addend is expected to be 0 for a function call"' failed
lhames accepted this revision.Sep 13 2023, 9:35 AM

Apologies for the delay on this. LGTM!

This revision is now accepted and ready to land.Sep 13 2023, 9:35 AM