[PATCH] D127842: [RuntimeDyld][RISCV] Minimal riscv64 support

Dmitrii Petrov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 16 01:34:11 PDT 2022


dnpetrov-sc added a comment.

In D127842#3586397 <https://reviews.llvm.org/D127842#3586397>, @lhames wrote:

> Thanks very much for raising this issue Dmitrii. We actually have relatively advanced RISCV support JITLink now, but it doesn't look like `llvm-exegesis` is using it. We should aim to update the `llvm-exegesis` tool, rather than RuntimeDyld. Do you know who is responsible for that tool these days?
>
>> Some of the OrcJIT tests keep failing on riscv64, just with a different message - unimplemented relocation type X instead of unsupported processor type.
>
> Can you share the failure message and context? This may be of interest to @StephenFan.

Build on riscv64,  run ExecutionEngine tests.
'main' fails with fatal error "Unsupported CPU type!" (in RuntimeDyldELF::resolveRelocation, RuntimeDyldELF.cpp:1076) in the following tests:

ExecutionEngine/frem.ll
ExecutionEngine/mov64zext32.ll
ExecutionEngine/test-interp-vec-arithm_float.ll
ExecutionEngine/test-interp-vec-arithm_int.ll
ExecutionEngine/test-interp-vec-logical.ll
ExecutionEngine/test-interp-vec-setcond-fp.ll
ExecutionEngine/test-interp-vec-setcond-int.ll
ExecutionEngine/Orc/./OrcJITTests/OrcCAPITestBase.AddObjectBuffer
ExecutionEngine/Orc/./OrcJITTests/OrcCAPITestBase.ExecutionTest
ExecutionEngine/Orc/./OrcJITTests/OrcCAPITestBase.ResourceTrackerDefinitionLifetime
ExecutionEngine/Orc/./OrcJITTests/OrcCAPITestBase.ResourceTrackerTransfer

Side note: it looks like there's a bug in ELFJITLinker_riscv::applyFixup (ELF_riscv.cpp:375):

  case R_RISCV_SUB6: {
    int64_t Value =
        *(reinterpret_cast<const uint8_t *>(FixupAddress.getValue())) &
        0x3f - E.getTarget().getAddress().getValue() - E.getAddend();
    *FixupPtr = (*FixupPtr & 0xc0) | (static_cast<uint8_t>(Value) & 0x3f);
    break;
  }

`&` has lower priority. That should be `(<old value> & <mask>) - <offset>`, but actually is `<old value> & (<mask> - <offset>)`, which doesn't look right. I don't have a reproducer on hand, though.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127842/new/

https://reviews.llvm.org/D127842



More information about the llvm-commits mailing list