Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release/5.0] Remove usages of native bootstrapping (#65901) #66406

Merged
merged 3 commits into from
Mar 15, 2022
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
43 changes: 35 additions & 8 deletions eng/native/functions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -155,20 +185,17 @@ 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
set (OBJ_FILE "${CMAKE_CURRENT_BINARY_DIR}/${COMPILE_ASM_TARGET}.dir/${CMAKE_CFG_INTDIR}/${name}.obj")

# 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)
Expand Down
10 changes: 3 additions & 7 deletions eng/pipelines/common/templates/runtimes/build-test-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
6 changes: 1 addition & 5 deletions eng/pipelines/coreclr/templates/build-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down
8 changes: 2 additions & 6 deletions eng/pipelines/mono/templates/build-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 0 additions & 4 deletions global.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 5 additions & 1 deletion src/coreclr/src/debug/di/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
6 changes: 5 additions & 1 deletion src/coreclr/src/debug/ee/wks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})

Expand Down
2 changes: 2 additions & 0 deletions src/coreclr/src/inc/crosscomp.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 5 additions & 1 deletion src/coreclr/src/vm/wks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 4 additions & 2 deletions src/installer/corehost/cli/ijwhost/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions src/mono/mono.proj
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,7 @@
<MonoExec>$(LocalMonoDotnet)</MonoExec>
</PropertyGroup>
<ItemGroup>
<AssembliesToPrecompile
<AssembliesToPrecompile
Include="$(LocalMonoDotnetDir)\shared\Microsoft.NETCore.App\**\*.dll"
Exclude="$(LocalMonoDotnetDir)\shared\Microsoft.NETCore.App\**\System.Runtime.WindowsRuntime.dll" />
</ItemGroup>
Expand Down Expand Up @@ -848,7 +848,7 @@
<Error Condition="'$(Destination)' == ''" Text="Destination should not be empty" />
<Error Condition="@(_MonoRuntimeArtifacts->Count()) &lt; 2" Text="Mono artifacts were not found at $(BinDir)" />
<Message Text="Copying Mono Runtime artifacts from '$(BinDir)' to '$(Destination)'.'" Importance="High" />
<Copy SourceFiles="@(_MonoRuntimeArtifacts)"
<Copy SourceFiles="@(_MonoRuntimeArtifacts)"
DestinationFolder="$(Destination)"
OverwriteReadOnlyFiles="true" />
</Target>
Expand Down Expand Up @@ -918,7 +918,7 @@
<Target Name="RunLibrariesTest" DependsOnTargets="PatchLibrariesTesthost">
<Error Condition="$(LibraryToTest) == ''" Text="LibraryToTest variable is not set" />
<Error Condition="$(LibraryToTest.EndsWith('.Tests'))" Text="LibraryToTest should not end with .Tests, e.g. just 'System.Runtime'" />
<MSBuild Projects="$(RepoRoot)src\libraries\$(LibraryToTest)\tests\$(LibraryToTest).Tests.csproj"
<MSBuild Projects="$(RepoRoot)src\libraries\$(LibraryToTest)\tests\$(LibraryToTest).Tests.csproj"
Properties="Configuration=$(LibrariesTestConfig)" Targets="Test" />
</Target>

Expand Down