diff options
author | Andy Gocke <andy@commentout.net> | 2022-03-15 04:52:05 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-15 04:52:05 +0300 |
commit | 5883f75f9248332125543a7f2e776beeb5fc6172 (patch) | |
tree | 685083d9b1d25ceb577b6751fff2209f31ed384f /eng/native | |
parent | 85ad38b28cc8afa027063f9c912bcf3a961ed00c (diff) |
[release/5.0] Remove usages of native bootstrapping (#65901) (#66406)
* Remove usages of native bootstrapping (#65901)
* Remove usages of native bootstrapping
* Make sure cmake is in the path for mono wasm builds
Co-authored-by: Adeel Mujahid <3840695+am11@users.noreply.github.com>
(cherry picked from commit 8727ac772e1d8031691ee52e2d66e2520f78d01a)
* Fix building CoreCLR for x86 with the Windows 10.0.20348.0 SDK (#57067)
The SDK now defines CONTEXT_UNWOUND_TO_CALL in more cases, so we get a macro redefinition error. Since the SDK defines it to the same value as we do, just skip our definition if it's already defined.
(cherry picked from commit ce4bf13ff1497b996383fd1917f218196fc63ea3)
* Port CMake fixes for latest version
Co-authored-by: Juan Hoyos <juan.s.hoyos@outlook.com>
Co-authored-by: Jeremy Koritzinsky <jekoritz@microsoft.com>
Diffstat (limited to 'eng/native')
-rw-r--r-- | eng/native/functions.cmake | 43 |
1 files changed, 35 insertions, 8 deletions
diff --git a/eng/native/functions.cmake b/eng/native/functions.cmake index 420b7d1a88f..df293a2cc83 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) |