Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Wrighton <davidwr@microsoft.com>2020-09-10 00:49:42 +0300
committerGitHub <noreply@github.com>2020-09-10 00:49:42 +0300
commit28e68bd70c5ebab0d475b199bfb32a68348d674d (patch)
tree4b5d5afc7c9544704befe0143417ec46b3d25ce6 /src/coreclr/clrdefinitions.cmake
parent5a1bcc83691b3ab7576c86a08cd4a19014cf896f (diff)
Build infra changes to enable building a more universal cross target jit builds (#41126)
This change is part of a larger effort to enable crossgen2 to perform general purpose cross compilation from any architecture to any other architecture. This portion of the change is to begin generating cross targeting jits with a consistent naming scheme with a minimal amount of code change. The practical output of this change is replacement of the current practice of building protojit/protononjit/etc. with `clrjit_<targetos>_<target_arch>_<host_arch>` binaries. In addition I've defined a couple of new subsets so that this can be less impactful to the inner dev loop. clr.alljits, which will build all of the jits. clr.jit, which will build only non-cross targeting jits. clr.runtime which has been enhanced to not trigger the alljits build. Current restrictions of the change: 1. This change does not support 32bit to 64bit compilation. I've built a larger change that includes the necessary work for that, but the changes are more disruptive, and I would prefer to scope this work to make it reviewable. 2. This work builds different compilers for the unix targetting and windows targetting compilers. This is due to the different ABIs that the architectures support. Upon investigation, I've determined that the actual product differences in these cases is small for ARM and ARM64. In the future, once we have testing, I believe it would be reasonable to unify the generated compiler binaries. 3. These changes do not build an armel targeting compiler for all scenarios, but it does build one with the current naming scheme as was done before. Again, like in condition 2, I believe we can make a single arm targetting compiler that will work. 4. These changes include changes to crossgen2 to use the new compiler binaries. However, there is no expanded testing to cover test the newly available cross compilation capabilities. That will appear in follow-on work.
Diffstat (limited to 'src/coreclr/clrdefinitions.cmake')
-rw-r--r--src/coreclr/clrdefinitions.cmake63
1 files changed, 51 insertions, 12 deletions
diff --git a/src/coreclr/clrdefinitions.cmake b/src/coreclr/clrdefinitions.cmake
index b717c10d840..eafe212786d 100644
--- a/src/coreclr/clrdefinitions.cmake
+++ b/src/coreclr/clrdefinitions.cmake
@@ -16,7 +16,7 @@ if (CLR_CMAKE_TARGET_ARCH_ARM64)
if (CLR_CMAKE_TARGET_UNIX)
add_definitions(-DFEATURE_EMULATE_SINGLESTEP)
endif()
- add_definitions(-DFEATURE_MULTIREG_RETURN)
+ add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:IGNORE_DEFAULT_TARGET_ARCH>>>:FEATURE_MULTIREG_RETURN>)
elseif (CLR_CMAKE_TARGET_ARCH_ARM)
if (CLR_CMAKE_HOST_WIN32 AND NOT DEFINED CLR_CROSS_COMPONENTS_BUILD)
# Set this to ensure we can use Arm SDK for Desktop binary linkage when doing native (Arm32) build
@@ -33,11 +33,12 @@ if (CLR_CMAKE_TARGET_UNIX)
endif(CLR_CMAKE_TARGET_OSX)
if (CLR_CMAKE_TARGET_ARCH_AMD64)
- add_definitions(-DUNIX_AMD64_ABI)
+ add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:IGNORE_DEFAULT_TARGET_ARCH>>>:UNIX_AMD64_ABI>)
+ add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:IGNORE_DEFAULT_TARGET_ARCH>>>:FEATURE_MULTIREG_RETURN>)
elseif (CLR_CMAKE_TARGET_ARCH_ARM)
- add_definitions(-DUNIX_ARM_ABI)
+ add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:IGNORE_DEFAULT_TARGET_ARCH>>>:UNIX_ARM_ABI>)
elseif (CLR_CMAKE_TARGET_ARCH_I386)
- add_definitions(-DUNIX_X86_ABI)
+ add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:IGNORE_DEFAULT_TARGET_ARCH>>>:UNIX_X86_ABI>)
endif()
endif(CLR_CMAKE_TARGET_UNIX)
@@ -145,7 +146,7 @@ endif(CLR_CMAKE_TARGET_LINUX OR CLR_CMAKE_TARGET_WIN32)
add_definitions(-DFEATURE_MANAGED_ETW_CHANNELS)
if(FEATURE_MERGE_JIT_AND_ENGINE)
- add_definitions(-DFEATURE_MERGE_JIT_AND_ENGINE)
+ add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:IGNORE_FEATURE_MERGE_JIT_AND_ENGINE>>>:FEATURE_MERGE_JIT_AND_ENGINE>)
endif(FEATURE_MERGE_JIT_AND_ENGINE)
add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:CROSSGEN_COMPONENT>>>:FEATURE_MULTICOREJIT>)
if(CLR_CMAKE_TARGET_UNIX)
@@ -199,12 +200,6 @@ if (CLR_CMAKE_TARGET_ARCH_AMD64)
# Enable the AMD64 Unix struct passing JIT-EE interface for all AMD64 platforms, to enable altjit.
add_definitions(-DUNIX_AMD64_ABI_ITF)
endif (CLR_CMAKE_TARGET_ARCH_AMD64)
-if(CLR_CMAKE_TARGET_UNIX_AMD64)
- add_definitions(-DFEATURE_MULTIREG_RETURN)
-endif (CLR_CMAKE_TARGET_UNIX_AMD64)
-if(CLR_CMAKE_TARGET_UNIX AND CLR_CMAKE_TARGET_ARCH_AMD64)
- add_definitions(-DUNIX_AMD64_ABI)
-endif(CLR_CMAKE_TARGET_UNIX AND CLR_CMAKE_TARGET_ARCH_AMD64)
add_definitions(-DFEATURE_USE_ASM_GC_WRITE_BARRIERS)
if(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_ARM64)
add_definitions(-DFEATURE_USE_SOFTWARE_WRITE_WATCH_FOR_GC_HEAP)
@@ -231,5 +226,49 @@ if(CLR_CMAKE_TARGET_OSX)
endif(CLR_CMAKE_TARGET_OSX)
if (NOT CLR_CMAKE_TARGET_ARCH_I386 OR NOT CLR_CMAKE_TARGET_WIN32)
- add_definitions(-DFEATURE_EH_FUNCLETS)
+ add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:IGNORE_DEFAULT_TARGET_ARCH>>>:FEATURE_EH_FUNCLETS>)
endif (NOT CLR_CMAKE_TARGET_ARCH_I386 OR NOT CLR_CMAKE_TARGET_WIN32)
+
+
+# Use this function to enable building with a specific target OS and architecture set of defines
+# This is known to work for the set of defines used by the JIT and gcinfo, it is not likely correct for
+# other components of the runtime
+function(set_target_definitions_to_custom_os_and_arch)
+ set(oneValueArgs TARGET OS ARCH)
+ cmake_parse_arguments(TARGETDETAILS "" "${oneValueArgs}" "" ${ARGN})
+
+ set_target_properties(${TARGETDETAILS_TARGET} PROPERTIES IGNORE_DEFAULT_TARGET_ARCH TRUE)
+ set_target_properties(${TARGETDETAILS_TARGET} PROPERTIES IGNORE_DEFAULT_TARGET_OS TRUE)
+
+ if ((TARGETDETAILS_OS STREQUAL "unix"))
+ target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_UNIX)
+ if (TARGETDETAILS_ARCH STREQUAL "x64")
+ target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE UNIX_AMD64_ABI)
+ target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE FEATURE_MULTIREG_RETURN)
+ elseif (TARGETDETAILS_ARCH STREQUAL "arm")
+ target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE UNIX_ARM_ABI)
+ elseif (TARGETDETAILS_ARCH STREQUAL "x86")
+ target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE UNIX_X86_ABI)
+ elseif (TARGETDETAILS_ARCH STREQUAL "arm64")
+ endif()
+ else()
+ target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_WINDOWS)
+ endif((TARGETDETAILS_OS STREQUAL "unix"))
+
+ if (TARGETDETAILS_ARCH STREQUAL "x86")
+ target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_X86)
+ elseif(TARGETDETAILS_ARCH STREQUAL "x64")
+ target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_64BIT)
+ target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_AMD64)
+ elseif(TARGETDETAILS_ARCH STREQUAL "arm64")
+ target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_64BIT)
+ target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_ARM64)
+ target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE FEATURE_MULTIREG_RETURN)
+ elseif(TARGETDETAILS_ARCH STREQUAL "arm")
+ target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_ARM)
+ endif()
+
+ if (NOT (TARGETDETAILS_ARCH STREQUAL "x86") OR (TARGETDETAILS_OS STREQUAL "unix"))
+ target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE FEATURE_EH_FUNCLETS)
+ endif (NOT (TARGETDETAILS_ARCH STREQUAL "x86") OR (TARGETDETAILS_OS STREQUAL "unix"))
+endfunction()