Skip to content

Commit ca004b1

Browse files
committed
[RISC-V] Force cmake to run robust mutexes runtime checks
1 parent c86bcbb commit ca004b1

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

eng/native/tryrun.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,6 @@ else()
123123
message(FATAL_ERROR "Unsupported platform. OS: ${CMAKE_SYSTEM_NAME}, arch: ${TARGET_ARCH_NAME}")
124124
endif()
125125

126-
if(TARGET_ARCH_NAME MATCHES "^(x86|x64|s390x|armv6|loongarch64|riscv64|ppc64le)$")
126+
if(TARGET_ARCH_NAME MATCHES "^(x86|x64|s390x|armv6|loongarch64|ppc64le)$")
127127
set_cache_value(HAVE_FUNCTIONAL_PTHREAD_ROBUST_MUTEXES_EXITCODE 0)
128128
endif()

src/coreclr/pal/src/configure.cmake

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,11 @@ int main()
697697
set(CMAKE_REQUIRED_LIBRARIES)
698698

699699
if(NOT CLR_CMAKE_HOST_ARCH_ARM AND NOT CLR_CMAKE_HOST_ARCH_ARM64)
700+
if (CLR_CMAKE_TARGET_ARCH_RISCV64 AND CMAKE_CROSSCOMPILING)
701+
unset(CMAKE_CROSSCOMPILING)
702+
set(CMAKE_RESTORE_CROSSCOMPILING 1)
703+
endif()
704+
700705
set(CMAKE_REQUIRED_LIBRARIES pthread)
701706
check_cxx_source_runs("
702707
// This test case verifies the pthread process-shared robust mutex's cross-process abandon detection. The parent process starts
@@ -883,6 +888,11 @@ if(NOT CLR_CMAKE_HOST_ARCH_ARM AND NOT CLR_CMAKE_HOST_ARCH_ARM64)
883888
return result >= 0 ? result : 0;
884889
}" HAVE_FUNCTIONAL_PTHREAD_ROBUST_MUTEXES)
885890
set(CMAKE_REQUIRED_LIBRARIES)
891+
892+
if(CMAKE_RESTORE_CROSSCOMPILING)
893+
set(CMAKE_CROSSCOMPILING)
894+
unset(CMAKE_RESTORE_CROSSCOMPILING)
895+
endif()
886896
endif()
887897

888898
if(CLR_CMAKE_TARGET_OSX)

0 commit comments

Comments
 (0)