[llvm-dev] lli cannot execute the bc file for RISCV, Unable to find target for this triple
Junning Wu via llvm-dev
llvm-dev at lists.llvm.org
Wed Apr 1 17:59:21 PDT 2020
*llvm-project version:dd8a2013dc1804be1b7d9cffacad2e984300bd22*
*Instructons to build LLVM+clang:*
```
cmake -G Ninja
-DCMAKE_INSTALL_PREFIX=/home/llvm/workspace/llvm/llvm-project/llvm_install
-DCMAKE_BUILD_TYPE="Release"
-DDEFAULT_SYSROOT="/home/llvm/workspace/riscv/riscv-tc-20200220/bin/riscv32-unknown-elf"
-DGCC_INSTALL_PREFIX="/home/llvm/workspace/riscv/riscv-tc-20200220"
-DLLVM_DEFAULT_TARGET_TRIPLE="riscv32-unknown-elf"
-DLLVM_ENABLE_PROJECTS="clang;lld;libc" -DLLVM_TARGETS_TO_BUILD="RISCV"
../llvm
```
*When compiling the obj file for the RTL simulation platform, everything is
ok. *
*But when I try to run the bc file using lli, I have such an error.*
```
#../llvm/llvm-project/llvm_install/bin/lli main.ll
../llvm/llvm-project/llvm_install/bin/lli: error: error creating EE: Unable
to find target for this triple (no targets are registered)
```
Clang & lli version(Confusion About " *riscv32-unknown-unknown-elf* " WITH
" *riscv32-unknown-elf* "):
```
$ ../llvm/llvm-project/llvm_install/bin/clang --version
clang version 11.0.0 (https://github.com/llvm/llvm-project.git
dd8a2013dc1804be1b7d9cffacad2e984300bd22)
Target: riscv32-unknown-unknown-elf
Thread model: posix
InstalledDir:
/home/llvm/workspace/test_lli/../llvm/llvm-project/llvm_install/bin
$ ../llvm/llvm-project/llvm_install/bin/lli --version
LLVM (http://llvm.org/):
LLVM version 11.0.0git
Optimized build.
Default target: riscv32-unknown-elf
Host CPU: skylake
```
*Instructons to generate main.ll:*
```
../llvm/llvm-project/llvm_install/bin/clang --target=riscv32-unknown-elf
--sysroot=/home/llvm/workspace/riscv/riscv-tc-20200220/bin/riscv32-unknown-elf
--gcc-toolchain=/home/llvm/workspace/riscv/riscv-tc-20200220
-march=rv32imac -mabi=ilp32
-I/home/llvm/workspace/llvm/llvm-project/llvm_install/riscv32-unknown-elf/include
-S -emit-llvm main.c
```
//main.c
```
#include <stdio.h>
int main(){
int a,b,c;
a = 5;
b = 2;
asm volatile
(
"norm %[z], %[x]\n\t"
: [z] "=r" (c)
: [x] "r" (a)
) ;
if ( c != 28 ){
printf("\nHAAWKING TEST: FAILED\n");
return -1;
}
printf("\nHAAWKING TEST: PASSED\n");
return 0;
}
```
Since I add some custom instructions to the RISC-V ISA and have not got a
simulator, so I want to check out whether these instructions using lli.
Can anyone figure out why this happens?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200402/5f8d1d97/attachment.html>
More information about the llvm-dev
mailing list