Issue |
148331
|
Summary |
[clang][KASAN][RISCV]How to Correctly Build Clang Containing KASAN
|
Labels |
clang
|
Assignees |
|
Reporter |
dong-miao
|
### Description
I am a beginner in clang.I want to debug the running process of LLVM KASAN for riscv64, but I used the following build configuration and ended up with an error. I want to know if there is a problem with my configuration, and what is the correct configuration to use -fsanitize=kernel-address option for riscv64.
```
cmake -G Ninja ../llvm \
-DLLVM_ENABLE_PROJECTS="clang;compiler-rt;lld" \
-DLLVM_TARGETS_TO_BUILD="RISCV" \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DCOMPILER_RT_DEFAULT_TARGET_TRIPLE="riscv64-unknown-elf" \
-DLLVM_USE_LINKER=lld \
-DCMAKE_BUILD_TYPE=DEBUG
```
### The error is:
```
static long syscall_impl_5_args(long number, long arg1, long arg2, long arg3,
long arg4, long arg5) {
register long a7 __asm__("a7") = number;
register long a0 __asm__("a0") = arg1;
register long a1 __asm__("a1") = arg2;
register long a2 __asm__("a2") = arg3;
register long a3 __asm__("a3") = arg4;
register long a4 __asm__("a4") = arg5;
__asm__ __volatile__("ecall\n\t"
: "=r"(a0)
: "r"(a7), "r"(a0), "r"(a1), "r"(a2), "r"(a3), "r"(a4)
: "memory");
return a0;
/home/rv-llvm/compiler-rt/lib/builtins/cpu_model/riscv.c:153:17: error: invalid register name for 'a7'
153 | register long a7 __asm__("a7") = number;
| ^~
/home/rv-llvm/compiler-rt/lib/builtins/cpu_model/riscv.c:154:17: error: invalid register name for 'a0'
154 | register long a0 __asm__("a0") = arg1;
| ^~
/home/rv-llvm/compiler-rt/lib/builtins/cpu_model/riscv.c:155:17: error: invalid register name for 'a1'
155 | register long a1 __asm__("a1") = arg2;
| ^~
/home/rv-llvm/compiler-rt/lib/builtins/cpu_model/riscv.c:156:17: error: invalid register name for 'a2'
156 | register long a2 __asm__("a2") = arg3;
| ^~
/home/rv-llvm/compiler-rt/lib/builtins/cpu_model/riscv.c:157:17: error: invalid register name for 'a3'
157 | register long a3 __asm__("a3") = arg4;
| ^~
/home/rv-llvm/compiler-rt/lib/builtins/cpu_model/riscv.c:158:17: error: invalid register name for 'a4'
158 | register long a4 __asm__("a4") = arg5;
```
Thank you all for your help!
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs