Skip to content

Commit

Permalink
[RISC-V] Force cmake to run robust mutexes runtime checks
Browse files Browse the repository at this point in the history
  • Loading branch information
yurai007 committed Aug 12, 2024
1 parent c86bcbb commit ca004b1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion eng/native/tryrun.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,6 @@ else()
message(FATAL_ERROR "Unsupported platform. OS: ${CMAKE_SYSTEM_NAME}, arch: ${TARGET_ARCH_NAME}")
endif()

if(TARGET_ARCH_NAME MATCHES "^(x86|x64|s390x|armv6|loongarch64|riscv64|ppc64le)$")
if(TARGET_ARCH_NAME MATCHES "^(x86|x64|s390x|armv6|loongarch64|ppc64le)$")
set_cache_value(HAVE_FUNCTIONAL_PTHREAD_ROBUST_MUTEXES_EXITCODE 0)
endif()
10 changes: 10 additions & 0 deletions src/coreclr/pal/src/configure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,11 @@ int main()
set(CMAKE_REQUIRED_LIBRARIES)

if(NOT CLR_CMAKE_HOST_ARCH_ARM AND NOT CLR_CMAKE_HOST_ARCH_ARM64)
if (CLR_CMAKE_TARGET_ARCH_RISCV64 AND CMAKE_CROSSCOMPILING)
unset(CMAKE_CROSSCOMPILING)
set(CMAKE_RESTORE_CROSSCOMPILING 1)
endif()

set(CMAKE_REQUIRED_LIBRARIES pthread)
check_cxx_source_runs("
// This test case verifies the pthread process-shared robust mutex's cross-process abandon detection. The parent process starts
Expand Down Expand Up @@ -883,6 +888,11 @@ if(NOT CLR_CMAKE_HOST_ARCH_ARM AND NOT CLR_CMAKE_HOST_ARCH_ARM64)
return result >= 0 ? result : 0;
}" HAVE_FUNCTIONAL_PTHREAD_ROBUST_MUTEXES)
set(CMAKE_REQUIRED_LIBRARIES)

if(CMAKE_RESTORE_CROSSCOMPILING)
set(CMAKE_CROSSCOMPILING)
unset(CMAKE_RESTORE_CROSSCOMPILING)
endif()
endif()

if(CLR_CMAKE_TARGET_OSX)
Expand Down

0 comments on commit ca004b1

Please sign in to comment.