Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions eng/native/build-commons.sh
Original file line number Diff line number Diff line change
Expand Up @@ -234,23 +234,19 @@ __HostOS=$os
__BuildOS=$os

# Get the number of processors available to the scheduler
# Other techniques such as `nproc` only get the number of
# processors available to a single process.
platform="$(uname)"
if [[ "$platform" == "FreeBSD" ]]; then
__NumProc=$(($(sysctl -n hw.ncpu)+1))
__NumProc="$(($(sysctl -n hw.ncpu)+1))"
elif [[ "$platform" == "NetBSD" || "$platform" == "SunOS" ]]; then
__NumProc=$(($(getconf NPROCESSORS_ONLN)+1))
__NumProc="$(($(getconf NPROCESSORS_ONLN)+1))"
elif [[ "$platform" == "Darwin" ]]; then
__NumProc=$(($(getconf _NPROCESSORS_ONLN)+1))
__NumProc="$(($(getconf _NPROCESSORS_ONLN)+1))"
elif command -v nproc > /dev/null 2>&1; then
__NumProc="$(nproc)"
elif (NAME=""; . /etc/os-release; test "$NAME" = "Tizen"); then
__NumProc="$(getconf _NPROCESSORS_ONLN)"
else
if command -v nproc > /dev/null 2>&1; then
__NumProc=$(nproc --all)
elif (NAME=""; . /etc/os-release; test "$NAME" = "Tizen"); then
__NumProc=$(getconf _NPROCESSORS_ONLN)
else
__NumProc=1
fi
__NumProc=1
fi

while :; do
Expand Down
7 changes: 7 additions & 0 deletions eng/native/configurecompiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,13 @@ if (CLR_CMAKE_HOST_WIN32)
endif()

elseif (NOT CLR_CMAKE_HOST_BROWSER)
# This is a workaround for upstream issue: https://gitlab.kitware.com/cmake/cmake/-/issues/22995.
#
# In Clang.cmake, the decision to use single or double hyphen for target and gcc-toolchain
# is made based on CMAKE_${LANG}_COMPILER_VERSION, but CMAKE_ASM_COMPILER_VERSION is empty
# so it picks up single hyphen options, which new clang versions don't recognize.
set (CMAKE_ASM_COMPILER_VERSION "${CMAKE_C_COMPILER_VERSION}")

enable_language(ASM)

endif(CLR_CMAKE_HOST_WIN32)
39 changes: 23 additions & 16 deletions eng/native/configuretools.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ if(NOT WIN32 AND NOT CLR_CMAKE_TARGET_BROWSER)
endif()
endif()

function(locate_toolchain_exec exec var)
function(locate_toolchain_exec exec var required)
string(TOUPPER ${exec} EXEC_UPPERCASE)
if(NOT "$ENV{CLR_${EXEC_UPPERCASE}}" STREQUAL "")
set(${var} "$ENV{CLR_${EXEC_UPPERCASE}}" PARENT_SCOPE)
Expand All @@ -34,33 +34,40 @@ if(NOT WIN32 AND NOT CLR_CMAKE_TARGET_BROWSER)
"${TOOLSET_PREFIX}${exec}${CLR_CMAKE_COMPILER_FILE_NAME_VERSION}"
"${TOOLSET_PREFIX}${exec}")

if (EXEC_LOCATION_${exec} STREQUAL "EXEC_LOCATION_${exec}-NOTFOUND")
message(FATAL_ERROR "Unable to find toolchain executable. Name: '${exec}', Prefix: '${TOOLSET_PREFIX}.'")
if (required AND EXEC_LOCATION_${exec} STREQUAL "EXEC_LOCATION_${exec}-NOTFOUND")
message(FATAL_ERROR "Unable to find toolchain executable. Name: '${exec}', Prefix: '${TOOLSET_PREFIX}'")
endif()

if (NOT EXEC_LOCATION_${exec} STREQUAL "EXEC_LOCATION_${exec}-NOTFOUND")
set(${var} ${EXEC_LOCATION_${exec}} PARENT_SCOPE)
endif()
set(${var} ${EXEC_LOCATION_${exec}} PARENT_SCOPE)
endfunction()

locate_toolchain_exec(ar CMAKE_AR)
locate_toolchain_exec(nm CMAKE_NM)
locate_toolchain_exec(ranlib CMAKE_RANLIB)
locate_toolchain_exec(ar CMAKE_AR YES)
locate_toolchain_exec(nm CMAKE_NM YES)
locate_toolchain_exec(ranlib CMAKE_RANLIB YES)

if(CMAKE_C_COMPILER_ID MATCHES "Clang")
locate_toolchain_exec(link CMAKE_LINKER)
locate_toolchain_exec(link CMAKE_LINKER YES)
endif()

if(NOT CLR_CMAKE_TARGET_OSX AND NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND (NOT CLR_CMAKE_TARGET_ANDROID OR CROSS_ROOTFS))
locate_toolchain_exec(objdump CMAKE_OBJDUMP)
locate_toolchain_exec(objcopy CMAKE_OBJCOPY)
locate_toolchain_exec(objdump CMAKE_OBJDUMP YES)

execute_process(
COMMAND ${CMAKE_OBJCOPY} --help
OUTPUT_VARIABLE OBJCOPY_HELP_OUTPUT
)
unset(CMAKE_OBJCOPY CACHE)
locate_toolchain_exec(objcopy CMAKE_OBJCOPY NO)

if (CMAKE_OBJCOPY)
execute_process(
COMMAND ${CMAKE_OBJCOPY} --help
OUTPUT_VARIABLE OBJCOPY_HELP_OUTPUT
)
endif()

# if llvm-objcopy does not support --only-keep-debug argument, try to locate binutils' objcopy
if (CMAKE_C_COMPILER_ID MATCHES "Clang" AND NOT "${OBJCOPY_HELP_OUTPUT}" MATCHES "--only-keep-debug")
if (NOT CMAKE_OBJCOPY OR (CMAKE_C_COMPILER_ID MATCHES "Clang" AND NOT "${OBJCOPY_HELP_OUTPUT}" MATCHES "--only-keep-debug"))
set(TOOLSET_PREFIX "")
locate_toolchain_exec(objcopy CMAKE_OBJCOPY)
locate_toolchain_exec(objcopy CMAKE_OBJCOPY YES)
endif ()

endif()
Expand Down
2 changes: 1 addition & 1 deletion eng/native/ijw/IJW.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ if (CLR_CMAKE_HOST_WIN32)
endfunction()

# 4365 - signed/unsigned mismatch
# 4679 - Could not import member. This is an issue with IJW and static abstract methods in interfaces.
# 4679 - Could not import member. This is an issue with IJW and static abstract methods in interfaces.
add_compile_options(/wd4365 /wd4679)

# IJW
Expand Down
6 changes: 3 additions & 3 deletions eng/native/init-os-and-arch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ case "$CPUName" in

s390x)
arch=s390x
;;
;;

ppc64le)
arch=ppc64le
;;
arch=ppc64le
;;
*)
echo "Unknown CPU $CPUName detected!"
exit 1
Expand Down
6 changes: 2 additions & 4 deletions src/coreclr/debug/ee/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,9 @@ set(CORDBEE_HEADERS_DAC

list(APPEND CORDBEE_SOURCES_WKS ${ARCH_SOURCES_DIR}/walker.cpp)

if(CLR_CMAKE_TARGET_ARCH_AMD64)
if (CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386)
list(APPEND CORDBEE_SOURCES_WKS ${ARCH_SOURCES_DIR}/debuggerregdisplayhelper.cpp)
elseif(CLR_CMAKE_TARGET_ARCH_I386)
list(APPEND CORDBEE_SOURCES_WKS ${ARCH_SOURCES_DIR}/debuggerregdisplayhelper.cpp)
endif()
endif ()

convert_to_absolute_path(CORDBEE_SOURCES_DAC ${CORDBEE_SOURCES_DAC})
convert_to_absolute_path(CORDBEE_SOURCES_WKS ${CORDBEE_SOURCES_WKS})
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/pal/inc/pal.h
Original file line number Diff line number Diff line change
Expand Up @@ -2653,7 +2653,7 @@ PALIMPORT BOOL PALAPI PAL_GetUnwindInfoSize(SIZE_T baseAddress, ULONG64 ehFrameH
#define PAL_CS_NATIVE_DATA_SIZE 48
#elif defined(__linux__) && defined(__loongarch64)
#define PAL_CS_NATIVE_DATA_SIZE 96
#elif defined(__linux__) && defined(_riscv) && __riscv_xlen == 64
#elif defined(__linux__) && defined(__riscv) && __riscv_xlen == 64
#define PAL_CS_NATIVE_DATA_SIZE 96
#else
#error PAL_CS_NATIVE_DATA_SIZE is not defined for this architecture
Expand Down Expand Up @@ -3742,7 +3742,7 @@ YieldProcessor()
__asm__ __volatile__( "yield");
#elif defined(HOST_LOONGARCH64)
__asm__ volatile( "dbar 0; \n");
#elif defined(HOST_RISV64)
#elif defined(HOST_RISCV64)
__asm__ __volatile__( "wfi");
#else
return;
Expand Down
26 changes: 14 additions & 12 deletions src/tests/Common/scripts/bringup_runtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -727,20 +727,22 @@ function run_test {
return $testScriptExitCode
}

# Variables for running tests in the background
if [ `uname` = "NetBSD" ]; then
NumProc=$(getconf NPROCESSORS_ONLN)
elif [ `uname` = "Darwin" ]; then
NumProc=$(getconf _NPROCESSORS_ONLN)
# Get the number of processors available to the scheduler
platform="$(uname)"
if [[ "$platform" == "FreeBSD" ]]; then
NumProc="$(($(sysctl -n hw.ncpu)+1))"
elif [[ "$platform" == "NetBSD" || "$platform" == "SunOS" ]]; then
NumProc="$(($(getconf NPROCESSORS_ONLN)+1))"
elif [[ "$platform" == "Darwin" ]]; then
NumProc="$(($(getconf _NPROCESSORS_ONLN)+1))"
elif command -v nproc > /dev/null 2>&1; then
NumProc="$(nproc)"
elif (NAME=""; . /etc/os-release; test "$NAME" = "Tizen"); then
NumProc="$(getconf _NPROCESSORS_ONLN)"
else
if [ -x "$(command -v nproc)" ]; then
NumProc=$(nproc --all)
elif [ -x "$(command -v getconf)" ]; then
NumProc=$(getconf _NPROCESSORS_ONLN)
else
NumProc=1
fi
NumProc=1
fi

((maxProcesses = $NumProc * 3 / 2)) # long tests delay process creation, use a few more processors

((processCount = 0))
Expand Down
22 changes: 12 additions & 10 deletions src/tests/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -358,17 +358,19 @@ else
fi

# Get the number of processors available to the scheduler
# Other techniques such as `nproc` only get the number of
# processors available to a single process.
__Platform="$(uname)"
if [[ "$__Platform" == "FreeBSD" ]]; then
__NumProc=$(($(sysctl -n hw.ncpu)+1))
elif [[ "$__Platform" == "NetBSD" || "$__Platform" == "SunOS" ]]; then
__NumProc=$(($(getconf NPROCESSORS_ONLN)+1))
elif [[ "$__Platform" == "Darwin" ]]; then
__NumProc=$(($(getconf _NPROCESSORS_ONLN)+1))
platform="$(uname)"
if [[ "$platform" == "FreeBSD" ]]; then
__NumProc="$(($(sysctl -n hw.ncpu)+1))"
elif [[ "$platform" == "NetBSD" || "$platform" == "SunOS" ]]; then
__NumProc="$(($(getconf NPROCESSORS_ONLN)+1))"
elif [[ "$platform" == "Darwin" ]]; then
__NumProc="$(($(getconf _NPROCESSORS_ONLN)+1))"
elif command -v nproc > /dev/null 2>&1; then
__NumProc="$(nproc)"
elif (NAME=""; . /etc/os-release; test "$NAME" = "Tizen"); then
__NumProc="$(getconf _NPROCESSORS_ONLN)"
else
__NumProc=$(nproc --all)
__NumProc=1
fi

# Set dependent variables
Expand Down