<div dir="ltr"><div><b>llvm-project version:dd8a2013dc1804be1b7d9cffacad2e984300bd22</b></div><div><b><br></b></div><div><b>Instructons to build LLVM+clang:</b></div><div><br></div><div>```</div><div>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<br></div><div>```</div><div><br></div><div><b>When compiling the obj file for the RTL simulation platform, everything is ok. </b></div><div><b>But when I try to run the bc file using lli, I have such an error.</b></div><div><br></div><div>```</div><div>#../llvm/llvm-project/llvm_install/bin/lli main.ll <br>../llvm/llvm-project/llvm_install/bin/lli: error: error creating EE: Unable to find target for this triple (no targets are registered)<br></div><div>```</div><div><br></div><div>Clang & lli version(Confusion About "

<b>riscv32-unknown-unknown-elf</b>

" WITH "

<b>riscv32-unknown-elf</b>

"):</div><div>```</div><div>$ ../llvm/llvm-project/llvm_install/bin/clang --version<br>clang version 11.0.0 (<a href="https://github.com/llvm/llvm-project.git">https://github.com/llvm/llvm-project.git</a> dd8a2013dc1804be1b7d9cffacad2e984300bd22)<br>Target: riscv32-unknown-unknown-elf<br>Thread model: posix<br>InstalledDir: /home/llvm/workspace/test_lli/../llvm/llvm-project/llvm_install/bin<br></div><div><br></div><div>$ ../llvm/llvm-project/llvm_install/bin/lli --version<br>LLVM (<a href="http://llvm.org/">http://llvm.org/</a>):<br>  LLVM version 11.0.0git<br>  Optimized build.<br>  Default target: riscv32-unknown-elf<br>  Host CPU: skylake<br></div><div>```</div><div><br></div><div>  <b>Instructons to generate main.ll:</b></div><div><br></div><div>```</div><div>../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<br></div><div>```  <br></div><div><br></div><div>//main.c</div><div>```</div><div>#include <stdio.h><br>int main(){<br>  int a,b,c;<br>  a = 5;<br>  b = 2;<br>  asm volatile<br>  (<br>    "norm   %[z], %[x]\n\t"<br>    : [z] "=r" (c)<br>    : [x] "r" (a)<br>  ) ; <br>   if ( c != 28 ){<br>     printf("\nHAAWKING TEST: FAILED\n");<br>     return -1;<br>  }<br>  printf("\nHAAWKING TEST: PASSED\n");<br>  return 0;<br>}<br></div><div>```</div><div><br></div><div>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.<br></div><div>Can anyone figure out why this happens?</div></div>