nthu-pllab / RISCV-DLR

This repository is a lightweight runtime for RISC-V utility.
10 stars 8 forks source link

ld failed with undefined reference to '__nop' #4

Open aywkwok opened 2 years ago

aywkwok commented 2 years ago

In this year's TVM conference 12/17/2021, there was a talk on "Optimization with TVM Hybrid OP on RISC-V with P Extension". I followed the speaker's link to here. Does this example work on RISC-V without P Extension? I tried your example. It compiled and built libDLR.a/DumpKernel clean (using LLVM without P Extension); but failed running this example in the ld step with __nop undefined error. Do you know how to fix?

In example/pre_quant_mobilenet_v1_tflite: make

/opt/riscv/bin/riscv64-unknown-elf-g++ -I/home/akwok/TVM-RVP/RISCV-DLR/install-riscv/include -Wl,--whole-archive /home/akwok/TVM-RVP/RISCV-DLR/install-riscv/lib/libDLR.a -Wl,--no-whole-archive -std=c++11 -g host.cpp mobilenet.s -o mobilenet /opt/riscv/lib/gcc/riscv64-unknown-elf/10.2.0/../../../../riscv64-unknown-elf/bin/ld: /tmp/ccZeynFN.o: in function dlr::DLR::Run()': /home/akwok/TVM-RVP/RISCV-DLR/example/pre_quant_mobilenet_v1_tflite/kernel.inc:515: undefined reference to__nop' collect2: error: ld returned 1 exit status Makefile:70: recipe for target 'mobilenet' failed make: *** [mobilenet] Error 1

Gocql022 commented 5 months ago

My English no so good, please translate the following text, I think it may help you(Chinese to English). undefined reference to nop'意味着没有定义nop()函数,我今天也遇到了这个问题,去网上查了下这个函数的含义,得知这是一个什么都不做只会延时(时间极其短暂)的函数,因此只需在引用了nop()的文件上面如此定义这个函数: void nop() { ; } 这样一个__nop()函数就定义好了,希望能帮到你😊