[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

*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
Target: riscv32-unknown-unknown-elf
Thread model: posix

$ ../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
-march=rv32imac -mabi=ilp32
-S -emit-llvm 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