diff --git a/eng/native/functions.cmake b/eng/native/functions.cmake index 420b7d1a88f7c..df293a2cc8310 100644 --- a/eng/native/functions.cmake +++ b/eng/native/functions.cmake @@ -143,8 +143,38 @@ function(preprocess_file inputFilename outputFilename) PROPERTIES GENERATED TRUE) endfunction() -# preprocess_compile_asm(TARGET target ASM_FILES file1 [file2 ...] OUTPUT_OBJECTS [variableName]) -function(preprocess_compile_asm) +# preprocess_files(PreprocessedFilesList [fileToPreprocess1 [fileToPreprocess2 ...]]) +function(preprocess_files PreprocessedFilesList) + set(FilesToPreprocess ${ARGN}) + foreach(ASM_FILE IN LISTS FilesToPreprocess) + # Inserts a custom command in CMake build to preprocess each asm source file + get_filename_component(name ${ASM_FILE} NAME_WE) + file(TO_CMAKE_PATH "${CMAKE_CURRENT_BINARY_DIR}/${name}.asm" ASM_PREPROCESSED_FILE) + preprocess_file(${ASM_FILE} ${ASM_PREPROCESSED_FILE}) + list(APPEND PreprocessedFiles ${ASM_PREPROCESSED_FILE}) + endforeach() + set(${PreprocessedFilesList} ${PreprocessedFiles} PARENT_SCOPE) +endfunction() + +function(set_exports_linker_option exports_filename) + if(LD_GNU OR LD_SOLARIS) + # Add linker exports file option + if(LD_SOLARIS) + set(EXPORTS_LINKER_OPTION -Wl,-M,${exports_filename} PARENT_SCOPE) + else() + set(EXPORTS_LINKER_OPTION -Wl,--version-script=${exports_filename} PARENT_SCOPE) + endif() + elseif(LD_OSX) + # Add linker exports file option + set(EXPORTS_LINKER_OPTION -Wl,-exported_symbols_list,${exports_filename} PARENT_SCOPE) + endif() +endfunction() + +# compile_asm(TARGET target ASM_FILES file1 [file2 ...] OUTPUT_OBJECTS [variableName]) +# CMake does not support the ARM or ARM64 assemblers on Windows when using the +# MSBuild generator. When the MSBuild generator is in use, we manually compile the assembly files +# using this function. +function(compile_asm) set(options "") set(oneValueArgs TARGET OUTPUT_OBJECTS) set(multiValueArgs ASM_FILES) @@ -155,10 +185,7 @@ function(preprocess_compile_asm) set (ASSEMBLED_OBJECTS "") foreach(ASM_FILE ${COMPILE_ASM_ASM_FILES}) - # Inserts a custom command in CMake build to preprocess each asm source file get_filename_component(name ${ASM_FILE} NAME_WE) - file(TO_CMAKE_PATH "${CMAKE_CURRENT_BINARY_DIR}/${name}.asm" ASM_PREPROCESSED_FILE) - preprocess_file(${ASM_FILE} ${ASM_PREPROCESSED_FILE}) # Produce object file where CMake would store .obj files for an OBJECT library. # ex: artifacts\obj\coreclr\Windows_NT.arm64.Debug\src\vm\wks\cee_wks.dir\Debug\AsmHelpers.obj @@ -166,9 +193,9 @@ function(preprocess_compile_asm) # Need to compile asm file using custom command as include directories are not provided to asm compiler add_custom_command(OUTPUT ${OBJ_FILE} - COMMAND "${CMAKE_ASM_MASM_COMPILER}" -g ${ASM_INCLUDE_DIRECTORIES} -o ${OBJ_FILE} ${ASM_PREPROCESSED_FILE} - DEPENDS ${ASM_PREPROCESSED_FILE} - COMMENT "Assembling ${ASM_PREPROCESSED_FILE} ---> \"${CMAKE_ASM_MASM_COMPILER}\" -g ${ASM_INCLUDE_DIRECTORIES} -o ${OBJ_FILE} ${ASM_PREPROCESSED_FILE}") + COMMAND "${CMAKE_ASM_COMPILER}" -g ${ASM_INCLUDE_DIRECTORIES} -o ${OBJ_FILE} ${ASM_FILE} + DEPENDS ${ASM_FILE} + COMMENT "Assembling ${ASM_FILE} ---> \"${CMAKE_ASM_COMPILER}\" -g ${ASM_INCLUDE_DIRECTORIES} -o ${OBJ_FILE} ${ASM_FILE}") # mark obj as source that does not require compile set_source_files_properties(${OBJ_FILE} PROPERTIES EXTERNAL_OBJECT TRUE) diff --git a/eng/pipelines/common/templates/runtimes/build-test-job.yml b/eng/pipelines/common/templates/runtimes/build-test-job.yml index c4eabe0eaa429..bd4e2a7af88e4 100644 --- a/eng/pipelines/common/templates/runtimes/build-test-job.yml +++ b/eng/pipelines/common/templates/runtimes/build-test-job.yml @@ -89,10 +89,6 @@ jobs: - ${{ if eq(parameters.osGroup, 'OSX') }}: - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup) displayName: Install native dependencies - - ${{ if eq(parameters.osGroup, 'Windows_NT') }}: - # Necessary to install correct cmake version - - script: $(Build.SourcesDirectory)\eng\common\init-tools-native.cmd -InstallDirectory $(Build.SourcesDirectory)\native-tools -Force - displayName: Install native dependencies # Optionally download live-built libraries @@ -113,17 +109,17 @@ jobs: artifactName: '$(coreClrProductArtifactName)' displayName: 'CoreCLR product build' - - ${{ if in(parameters.osGroup, 'OSX', 'iOS','tvOS') }}: + - ${{ if in(parameters.osGroup, 'OSX', 'iOS','tvOS') }}: - script: | du -sh $(Build.SourcesDirectory)/* df -h displayName: Disk Usage before Build - + # Build managed test components - script: $(Build.SourcesDirectory)/src/coreclr/build-test$(scriptExt) allTargets skipstressdependencies skipnative skipgeneratelayout skiptestwrappers $(buildConfig) $(archType) $(crossArg) $(priorityArg) ci $(librariesOverrideArg) displayName: Build managed test components - - ${{ if in(parameters.osGroup, 'OSX', 'iOS','tvOS') }}: + - ${{ if in(parameters.osGroup, 'OSX', 'iOS','tvOS') }}: - script: | du -sh $(Build.SourcesDirectory)/* df -h diff --git a/eng/pipelines/coreclr/templates/build-job.yml b/eng/pipelines/coreclr/templates/build-job.yml index 91a5cb0624751..a58d4bab04afe 100644 --- a/eng/pipelines/coreclr/templates/build-job.yml +++ b/eng/pipelines/coreclr/templates/build-job.yml @@ -121,10 +121,6 @@ jobs: - ${{ if eq(parameters.osGroup, 'OSX') }}: - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup) displayName: Install native dependencies - - ${{ if eq(parameters.osGroup, 'Windows_NT') }}: - # Necessary to install python - - script: $(Build.SourcesDirectory)\eng\common\init-tools-native.cmd -InstallDirectory $(Build.SourcesDirectory)\native-tools -Force - displayName: Install native dependencies # Install internal tools on official builds # Since our internal tools are behind an authenticated feed, @@ -173,7 +169,7 @@ jobs: - template: /eng/pipelines/common/macos-sign-with-entitlements.yml parameters: - filesToSign: + filesToSign: - name: createdump path: $(buildProductRootFolderPath) entitlementsFile: $(Build.SourcesDirectory)/eng/pipelines/common/createdump-entitlements.plist diff --git a/eng/pipelines/mono/templates/build-job.yml b/eng/pipelines/mono/templates/build-job.yml index e46ca5ee005f2..36cc1c6b36334 100644 --- a/eng/pipelines/mono/templates/build-job.yml +++ b/eng/pipelines/mono/templates/build-job.yml @@ -89,12 +89,8 @@ jobs: - ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}: - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup) displayName: Install native dependencies - - ${{ if eq(parameters.osGroup, 'Windows_NT') }}: - # Necessary to install python - - script: $(Build.SourcesDirectory)\eng\common\init-tools-native.cmd -InstallDirectory $(Build.SourcesDirectory)\native-tools -Force - displayName: Install native dependencies - - ${{ if in(parameters.osGroup, 'OSX', 'iOS','tvOS') }}: + - ${{ if in(parameters.osGroup, 'OSX', 'iOS','tvOS') }}: - script: | du -sh $(Build.SourcesDirectory)/* df -h @@ -108,7 +104,7 @@ jobs: - script: build$(scriptExt) -subset mono -c $(buildConfig) -arch $(archType) $(osOverride) -ci $(officialBuildIdArg) $(llvmParameter) displayName: Build product - - ${{ if in(parameters.osGroup, 'OSX', 'iOS','tvOS') }}: + - ${{ if in(parameters.osGroup, 'OSX', 'iOS','tvOS') }}: - script: | du -sh $(Build.SourcesDirectory)/* df -h diff --git a/global.json b/global.json index 7822077ad2c3b..ea7f876afea52 100644 --- a/global.json +++ b/global.json @@ -7,10 +7,6 @@ "tools": { "dotnet": "5.0.401" }, - "native-tools": { - "cmake": "3.14.5", - "python3": "3.7.1" - }, "msbuild-sdks": { "Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk": "5.0.0-beta.21565.1", "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.21565.1", diff --git a/src/coreclr/src/debug/di/CMakeLists.txt b/src/coreclr/src/debug/di/CMakeLists.txt index 6cfedda1d8990..1637cd14f6120 100644 --- a/src/coreclr/src/debug/di/CMakeLists.txt +++ b/src/coreclr/src/debug/di/CMakeLists.txt @@ -59,7 +59,11 @@ if(CLR_CMAKE_HOST_WIN32) if ((CLR_CMAKE_TARGET_ARCH_ARM OR CLR_CMAKE_TARGET_ARCH_ARM64) AND NOT DEFINED CLR_CROSS_COMPONENTS_BUILD) convert_to_absolute_path(CORDBDI_SOURCES_ASM_FILE ${CORDBDI_SOURCES_ASM_FILE}) - preprocess_compile_asm(TARGET cordbdi ASM_FILES ${CORDBDI_SOURCES_ASM_FILE} OUTPUT_OBJECTS CORDBDI_SOURCES_ASM_FILE) + preprocess_files(CORDBDI_SOURCES_ASM_FILE ${CORDBDI_SOURCES_ASM_FILE}) + + if (CMAKE_GENERATOR MATCHES "Visual Studio") + compile_asm(TARGET cordbdi ASM_FILES ${CORDBDI_SOURCES_ASM_FILE} OUTPUT_OBJECTS CORDBDI_SOURCES_ASM_FILE) + endif() endif() elseif(CLR_CMAKE_HOST_UNIX) diff --git a/src/coreclr/src/debug/ee/wks/CMakeLists.txt b/src/coreclr/src/debug/ee/wks/CMakeLists.txt index 3dd5e3612dfc8..6d637da54063f 100644 --- a/src/coreclr/src/debug/ee/wks/CMakeLists.txt +++ b/src/coreclr/src/debug/ee/wks/CMakeLists.txt @@ -9,7 +9,11 @@ if (CLR_CMAKE_TARGET_WIN32) if(CLR_CMAKE_HOST_ARCH_ARM OR CLR_CMAKE_HOST_ARCH_ARM64) - preprocess_compile_asm(TARGET cordbee_wks_obj ASM_FILES ${ASM_FILE} OUTPUT_OBJECTS ASM_OBJECTS) + preprocess_files(ASM_FILE ${ASM_FILE}) + + if (CMAKE_GENERATOR MATCHES "Visual Studio") + compile_asm(TARGET cordbee_wks_obj ASM_FILES ${ASM_FILE} OUTPUT_OBJECTS ASM_OBJECTS) + endif() add_library_clr(cordbee_wks_obj OBJECT ${CORDBEE_SOURCES_WKS} ${ASM_FILE} ${ASM_OBJECTS}) diff --git a/src/coreclr/src/inc/crosscomp.h b/src/coreclr/src/inc/crosscomp.h index 5b6e932fd24f6..6981fea2c9718 100644 --- a/src/coreclr/src/inc/crosscomp.h +++ b/src/coreclr/src/inc/crosscomp.h @@ -41,7 +41,9 @@ #define ARM_MAX_BREAKPOINTS 8 #define ARM_MAX_WATCHPOINTS 1 +#ifndef CONTEXT_UNWOUND_TO_CALL #define CONTEXT_UNWOUND_TO_CALL 0x20000000 +#endif typedef struct _NEON128 { ULONGLONG Low; diff --git a/src/coreclr/src/vm/wks/CMakeLists.txt b/src/coreclr/src/vm/wks/CMakeLists.txt index 7c3dd84bd3d03..1b34bf67b65d3 100644 --- a/src/coreclr/src/vm/wks/CMakeLists.txt +++ b/src/coreclr/src/vm/wks/CMakeLists.txt @@ -2,7 +2,11 @@ if (CLR_CMAKE_TARGET_WIN32) if(CLR_CMAKE_HOST_ARCH_ARM OR CLR_CMAKE_HOST_ARCH_ARM64) - preprocess_compile_asm(TARGET cee_wks_core ASM_FILES ${VM_SOURCES_WKS_ARCH_ASM} OUTPUT_OBJECTS VM_WKS_ARCH_ASM_OBJECTS) + preprocess_files(VM_SOURCES_WKS_ARCH_ASM ${VM_SOURCES_WKS_ARCH_ASM}) + + if (CMAKE_GENERATOR MATCHES "Visual Studio") + compile_asm(TARGET cee_wks_core ASM_FILES ${VM_SOURCES_WKS_ARCH_ASM} OUTPUT_OBJECTS VM_WKS_ARCH_ASM_OBJECTS) + endif() endif() endif (CLR_CMAKE_TARGET_WIN32) diff --git a/src/installer/corehost/cli/ijwhost/CMakeLists.txt b/src/installer/corehost/cli/ijwhost/CMakeLists.txt index 4a56583af3a47..d790b01709f12 100644 --- a/src/installer/corehost/cli/ijwhost/CMakeLists.txt +++ b/src/installer/corehost/cli/ijwhost/CMakeLists.txt @@ -33,8 +33,10 @@ convert_to_absolute_path(SOURCES ${SOURCES}) convert_to_absolute_path(ASM_HELPERS_SOURCES ${ASM_HELPERS_SOURCES}) if (CLR_CMAKE_TARGET_WIN32 AND (CLR_CMAKE_TARGET_ARCH_ARM OR CLR_CMAKE_TARGET_ARCH_ARM64)) - preprocess_compile_asm(TARGET ijwhost ASM_FILES ${ASM_HELPERS_SOURCES} OUTPUT_OBJECTS ASM_HELPERS_OBJECTS) - list(APPEND ASM_HELPERS_SOURCES ${ASM_HELPERS_OBJECTS}) + preprocess_files(ASM_HELPERS_SOURCES ${ASM_HELPERS_SOURCES}) + if (CMAKE_GENERATOR MATCHES "Visual Studio") + compile_asm(TARGET ijwhost ASM_FILES ${ASM_HELPERS_SOURCES} OUTPUT_OBJECTS ASM_HELPERS_SOURCES) + endif() endif () if (CLR_CMAKE_TARGET_WIN32 AND CLR_CMAKE_TARGET_ARCH_I386) diff --git a/src/mono/mono.proj b/src/mono/mono.proj index a11853b47c527..b651d2ad769a3 100644 --- a/src/mono/mono.proj +++ b/src/mono/mono.proj @@ -810,7 +810,7 @@ $(LocalMonoDotnet) - @@ -848,7 +848,7 @@ - @@ -918,7 +918,7 @@ -