[compiler-rt] 5b27578 - [builtins][LoongArch] Port __clear_cache to LoongArch Linux

Weining Lu via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 1 05:16:11 PDT 2022


Author: Youling Tang
Date: 2022-11-01T20:15:09+08:00
New Revision: 5b27578fc52bdf06e2d81a271705a39266b047fe

URL: https://github.com/llvm/llvm-project/commit/5b27578fc52bdf06e2d81a271705a39266b047fe
DIFF: https://github.com/llvm/llvm-project/commit/5b27578fc52bdf06e2d81a271705a39266b047fe.diff

LOG: [builtins][LoongArch] Port __clear_cache to LoongArch Linux

There are two failures in the current builtins,
Failed Tests (2):
  Builtins-loongarch64-linux :: clear_cache_test.c
  Builtins-loongarch64-linux :: enable_execute_stack_test.c

It is caused by __clear_cache not being implemented and triggering `abort`.

"__clear_cache" is implemented in the same way as "clear_cache" in gcc (
in gcc/config/loongarch/loongarch.md)

Differential Revision: https://reviews.llvm.org/D136921

Added: 
    

Modified: 
    compiler-rt/lib/builtins/clear_cache.c

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/builtins/clear_cache.c b/compiler-rt/lib/builtins/clear_cache.c
index 9816940b504a7..bcc5922e073b3 100644
--- a/compiler-rt/lib/builtins/clear_cache.c
+++ b/compiler-rt/lib/builtins/clear_cache.c
@@ -91,6 +91,8 @@ void __clear_cache(void *start, void *end) {
 #else
   compilerrt_abort();
 #endif
+#elif defined(__linux__) && defined(__loongarch__)
+  __asm__ volatile("ibar 0");
 #elif defined(__linux__) && defined(__mips__)
   const uintptr_t start_int = (uintptr_t)start;
   const uintptr_t end_int = (uintptr_t)end;


        


More information about the llvm-commits mailing list