HomePhabricator

[JITLink][RISCV] Initial Support RISCV64 in JITLink

Authored by StephenFan on Jul 5 2021, 5:04 AM.

Description

[JITLink][RISCV] Initial Support RISCV64 in JITLink

This patch is the initial support, it implements translation from object file to JIT link graph, and very few relocations were supported. Currently, the test file ELF_pc_indirect.s is passed, the HelloWorld program(compiled with mno-relax flag) can be linked correctly and run on instruction emulator correctly.

In the downstream implementation, I have implemented the GOT, PLT function, and EHFrame and some optimization will be implement soon. I will organize the code in to patches, then gradually send it to upstream.

Differential Revision: https://reviews.llvm.org/D105429

Details

Committed
StephenFanJul 23 2021, 8:47 AM
Differential Revision
D105429: [JITLink][RISCV] Initial Support RISCV64 in JITLink
Parents
rG9482aa98e551: [lld/mac] Let OutputSegment store its start address
Branches
Unknown
Tags
Unknown

Event Timeline

Herald added subscribers: Restricted Project, HsiangKai. · View Herald TranscriptJul 23 2021, 8:48 AM
abhinavgaba added inline comments.
/llvm/test/ExecutionEngine/JITLink/RISCV/ELF_pc_indirect.s
1

I think you need this to not run the test on unsupported targets:

diff --git a/llvm/test/ExecutionEngine/JITLink/RISCV/lit.local.cfg b/llvm/test/ExecutionEngine/JITLink/RISCV/lit.local.cfg
new file mode 100644
index 000000000000..7a762d490ba5
--- /dev/null
+++ b/llvm/test/ExecutionEngine/JITLink/RISCV/lit.local.cfg
@@ -0,0 +1,2 @@
+if not 'RISCV' in config.root.targets:
+  config.unsupported = True

Please take a look.