From 54ece88f4437619024efce65ec61b47502265c19 Mon Sep 17 00:00:00 2001 From: Wang Chen Date: Tue, 28 Feb 2023 14:39:08 +0800 Subject: [PATCH 1/2] don't use libatomic for android/clang Signed-off-by: Wang Chen --- BUILD.gn | 24 ++++++++++++++++++------ test/unittests/BUILD.gn | 4 +++- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index 4060a1528249..754aa6488bf0 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -641,7 +641,9 @@ config("internal_config") { } if (v8_current_cpu == "riscv64" || v8_current_cpu == "riscv32") { - libs = [ "atomic" ] + if (target_os != "android") { + libs = [ "atomic" ] + } } } @@ -713,7 +715,9 @@ config("external_config") { } if (current_cpu == "riscv64" || current_cpu == "riscv32") { - libs = [ "atomic" ] + if (target_os != "android") { + libs = [ "atomic" ] + } } } @@ -5200,7 +5204,9 @@ v8_source_set("v8_base_without_compiler") { v8_current_cpu == "ppc" || v8_current_cpu == "ppc64" || v8_current_cpu == "s390" || v8_current_cpu == "s390x" || v8_current_cpu == "riscv64" || v8_current_cpu == "riscv32") { - libs += [ "atomic" ] + if (target_os != "android") { + libs += [ "atomic" ] + } } if (v8_enable_vtunetracemark && (is_linux || is_chromeos || is_win)) { @@ -5602,7 +5608,9 @@ v8_component("v8_libbase") { } if (v8_current_cpu == "riscv64" || v8_current_cpu == "riscv32") { - libs += [ "atomic" ] + if (target_os != "android") { + libs += [ "atomic" ] + } } if (is_tsan && !build_with_chromium) { @@ -5691,7 +5699,9 @@ v8_component("v8_libplatform") { } if (v8_current_cpu == "riscv64" || v8_current_cpu == "riscv32") { - libs = [ "atomic" ] + if (target_os != "android") { + libs = [ "atomic" ] + } } } @@ -6614,7 +6624,9 @@ v8_executable("cppgc_hello_world") { sources = [ "samples/cppgc/hello-world.cc" ] if (v8_current_cpu == "riscv64" || v8_current_cpu == "riscv32") { - libs = [ "atomic" ] + if (target_os != "android") { + libs = [ "atomic" ] + } } configs = [ diff --git a/test/unittests/BUILD.gn b/test/unittests/BUILD.gn index ff952d03b21f..cbeb0120c3e1 100644 --- a/test/unittests/BUILD.gn +++ b/test/unittests/BUILD.gn @@ -83,7 +83,9 @@ if (cppgc_is_standalone) { v8_executable("cppgc_unittests") { testonly = true if (v8_current_cpu == "riscv64" || v8_current_cpu == "riscv32") { - libs = [ "atomic" ] + if (target_os != "android") { + libs = [ "atomic" ] + } } configs = [ From d1133b63a36b3cb3ba6270cfd3f7a875c8027821 Mon Sep 17 00:00:00 2001 From: Wang Chen Date: Tue, 28 Feb 2023 14:40:19 +0800 Subject: [PATCH 2/2] directly use syscall number macro For android/clang, we don't use gcc lib/header files. So use __NR_riscv_flush_icache should be fine for all of us. Signed-off-by: Wang Chen Signed-off-by: McKnight22 --- src/codegen/riscv/cpu-riscv.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/codegen/riscv/cpu-riscv.cc b/src/codegen/riscv/cpu-riscv.cc index 205e13fa988c..8e3db2803d20 100644 --- a/src/codegen/riscv/cpu-riscv.cc +++ b/src/codegen/riscv/cpu-riscv.cc @@ -20,7 +20,7 @@ void CpuFeatures::FlushICache(void* start, size_t size) { // uintptr_t, end, uintptr_t, flags) // The flag here is set to be SYS_RISCV_FLUSH_ICACHE_LOCAL, which is // defined as 1 in the Linux kernel. - syscall(SYS_riscv_flush_icache, start, end, 1); + syscall(__NR_riscv_flush_icache, start, end, 1); #endif // !USE_SIMULATOR. }