summaryrefslogtreecommitdiff
path: root/src/vm
diff options
context:
space:
mode:
authorGaurav Khanna <gkhanna@microsoft.com>2016-08-24 17:58:42 -0700
committerGitHub <noreply@github.com>2016-08-24 17:58:42 -0700
commit9426f7ed702e5b8cbc4ffb0ad89a2ad7a448c56c (patch)
tree2cd2440479f4463ec9f9851c57d19300e75ec6e2 /src/vm
parentdf50db75953d87485563c7542048f4c1aa402ede (diff)
parent6b5695013d972fd1239241a6613865749123e0fa (diff)
downloadcoreclr-9426f7ed702e5b8cbc4ffb0ad89a2ad7a448c56c.tar.gz
coreclr-9426f7ed702e5b8cbc4ffb0ad89a2ad7a448c56c.tar.bz2
coreclr-9426f7ed702e5b8cbc4ffb0ad89a2ad7a448c56c.zip
Merge pull request #6883 from gkhanna79/WinArm32
Enable Windows Arm32 build
Diffstat (limited to 'src/vm')
-rw-r--r--src/vm/CMakeLists.txt9
-rw-r--r--src/vm/arm/memcpy.asm2
-rw-r--r--src/vm/arm/patchedcode.asm4
-rw-r--r--src/vm/wks/CMakeLists.txt132
4 files changed, 104 insertions, 43 deletions
diff --git a/src/vm/CMakeLists.txt b/src/vm/CMakeLists.txt
index 66fc6432af..6f17a90c1f 100644
--- a/src/vm/CMakeLists.txt
+++ b/src/vm/CMakeLists.txt
@@ -328,6 +328,15 @@ elseif(CLR_CMAKE_TARGET_ARCH_I386)
${ARCH_SOURCES_DIR}/gmsasm.asm
${ARCH_SOURCES_DIR}/jithelp.asm
)
+elseif(CLR_CMAKE_TARGET_ARCH_ARM)
+ set(VM_SOURCES_WKS_ARCH_ASM
+ ${ARCH_SOURCES_DIR}/asmhelpers.asm
+ ${ARCH_SOURCES_DIR}/CrtHelpers.asm
+ ${ARCH_SOURCES_DIR}/ehhelpers.asm
+ ${ARCH_SOURCES_DIR}/memcpy.asm
+ ${ARCH_SOURCES_DIR}/patchedcode.asm
+ ${ARCH_SOURCES_DIR}/PInvokeStubs.asm
+ )
elseif(CLR_CMAKE_TARGET_ARCH_ARM64)
set(VM_SOURCES_WKS_ARCH_ASM
${ARCH_SOURCES_DIR}/AsmHelpers.asm
diff --git a/src/vm/arm/memcpy.asm b/src/vm/arm/memcpy.asm
index 65c662c2d7..9a0e7d373f 100644
--- a/src/vm/arm/memcpy.asm
+++ b/src/vm/arm/memcpy.asm
@@ -31,7 +31,7 @@
pld [r1] ; preload the first cache line
cmp r2, #16 ; less than 16 bytes?
mov r3, r0 ; use r3 as our destination
- bhs __FCallMemcpy_large ; go to the large copy case directly
+ bhs.W __FCallMemcpy_large ; go to the large copy case directly. ".W" indicates encoding using 32bits
CpySmal tbb [pc, r2] ; branch to specialized bits for small copies
__SwitchTable1_Copy
diff --git a/src/vm/arm/patchedcode.asm b/src/vm/arm/patchedcode.asm
index 2ccda5810f..2ef175ea56 100644
--- a/src/vm/arm/patchedcode.asm
+++ b/src/vm/arm/patchedcode.asm
@@ -119,6 +119,8 @@ $label
; patchable location where the write-barriers are copied over at runtime
LEAF_ENTRY JIT_PatchedWriteBarrierStart
+ ; Cannot be empty function to prevent LNK1223
+ bx lr
LEAF_END
; These write barriers are overwritten on the fly
@@ -139,6 +141,8 @@ $label
LEAF_END_MARKED JIT_ByRefWriteBarrier
LEAF_ENTRY JIT_PatchedWriteBarrierLast
+ ; Cannot be empty function to prevent LNK1223
+ bx lr
LEAF_END
; JIT Allocation helpers when TLS Index for Thread is low enough for fast helpers
diff --git a/src/vm/wks/CMakeLists.txt b/src/vm/wks/CMakeLists.txt
index 0ff0ccb9a6..360845d0b2 100644
--- a/src/vm/wks/CMakeLists.txt
+++ b/src/vm/wks/CMakeLists.txt
@@ -1,3 +1,4 @@
+
if (WIN32)
add_precompiled_header(common.h ../common.cpp VM_SOURCES_WKS)
# mscorlib.cpp does not compile with precompiled header file
@@ -5,63 +6,110 @@ if (WIN32)
# .c file cannot use cpp precompiled header
set_source_files_properties(../microsoft.comservices_i.c PROPERTIES COMPILE_FLAGS "/Y-")
- # asm files require preprocessing using cl.exe on arm64
+ # asm files require preprocessing using cl.exe on arm32 and arm64
if(CLR_CMAKE_PLATFORM_ARCH_ARM64)
+
foreach(ASM_FILE ${VM_SOURCES_WKS_ARCH_ASM})
+
+ # Preprocess each asm source file
get_filename_component(name ${ASM_FILE} NAME_WE)
set(ASM_PREPROCESSED_FILE ${CMAKE_CURRENT_BINARY_DIR}/${name}.asm)
preprocess_def_file(${ASM_FILE} ${ASM_PREPROCESSED_FILE})
+
set(VM_SOURCES_WKS_ARM64_PREPROCESSED_ASM ${VM_SOURCES_WKS_ARM64_PREPROCESSED_ASM} ${ASM_PREPROCESSED_FILE})
+
endforeach()
set(VM_SOURCES_WKS_ARCH_ASM ${VM_SOURCES_WKS_ARM64_PREPROCESSED_ASM})
+
+ elseif(CLR_CMAKE_PLATFORM_ARCH_ARM)
+
+ get_include_directories_asm(ASM_INCLUDE_DIRECTORIES)
+
+ foreach(ASM_FILE ${VM_SOURCES_WKS_ARCH_ASM})
+
+ # 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_def_file(${ASM_FILE} ${ASM_PREPROCESSED_FILE})
+
+ # On Arm32, compile the preprocessed binary to .obj
+ # We do not pass any defines since we have already done pre-processing above
+ set (ASM_CMDLINE "-o ${CMAKE_CURRENT_BINARY_DIR}/${name}.obj ${ASM_PREPROCESSED_FILE}")
+
+ # Generate the batch file that will invoke the assembler
+ file(TO_CMAKE_PATH "${CMAKE_CURRENT_BINARY_DIR}/runasm_${name}_${CMAKE_BUILD_TYPE}.cmd" ASM_SCRIPT_FILE)
+
+ file(GENERATE OUTPUT "${ASM_SCRIPT_FILE}"
+ CONTENT "\"${CMAKE_ASM_MASM_COMPILER}\" -g ${ASM_INCLUDE_DIRECTORIES} ${ASM_DEFINITIONS} ${ASM_CMDLINE}")
+
+ message("Generated - ${ASM_SCRIPT_FILE}")
+
+ # Need to compile asm file using custom command as include directories are not provided to asm compiler
+ add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${name}.obj
+ COMMAND ${ASM_SCRIPT_FILE}
+ DEPENDS ${ASM_PREPROCESSED_FILE}
+ COMMENT "Assembling ${ASM_PREPROCESSED_FILE} - ${ASM_SCRIPT_FILE}")
+
+ # mark obj as source that does not require compile
+ set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${name}.obj PROPERTIES EXTERNAL_OBJECT TRUE)
+
+ # Add the generated OBJ in the dependency list so that it gets consumed during linkage
+ set(VM_SOURCES_WKS_ARCH_ASM ${VM_SOURCES_WKS_ARCH_ASM} ${CMAKE_CURRENT_BINARY_DIR}/${name}.obj)
+
+ endforeach()
+
endif(CLR_CMAKE_PLATFORM_ARCH_ARM64)
+
endif (WIN32)
add_library_clr(cee_wks ${VM_SOURCES_WKS} ${VM_SOURCES_WKS_ARCH_ASM})
if (WIN32)
-# Get the current list of definitions
-get_compile_definitions(DEFINITIONS)
-
-get_directory_property(COMPILE_DEFINITIONS_LIST COMPILE_DEFINITIONS)
-
-# Extract the definitions for the ASM code. Since there is a bug in the cmake that prevents us from
-# using the generator expressions, we split the definitions into lists based on the configuration.
-foreach(DEFINITION IN LISTS COMPILE_DEFINITIONS_LIST)
- if (${DEFINITION} MATCHES "^\\$<\\$<CONFIG:([^>]+)>:([^>]+)>$")
- # The entry contains generator expression, so insert the definition into a definitions list
- # corresponding to the config
- string(TOUPPER ${CMAKE_MATCH_1} CONFIG)
- set(ASM_DEFINITIONS_${CONFIG} ${ASM_DEFINITIONS_${CONFIG}} ${CMAKE_MATCH_2})
- else()
- list(APPEND ASM_DEFINITIONS ${DEFINITION})
+
+ if(NOT CLR_CMAKE_PLATFORM_ARCH_ARM)
+ # Get the current list of definitions
+ get_compile_definitions(DEFINITIONS)
+
+ get_directory_property(COMPILE_DEFINITIONS_LIST COMPILE_DEFINITIONS)
+
+ # Extract the definitions for the ASM code. Since there is a bug in the cmake that prevents us from
+ # using the generator expressions, we split the definitions into lists based on the configuration.
+ foreach(DEFINITION IN LISTS COMPILE_DEFINITIONS_LIST)
+ if (${DEFINITION} MATCHES "^\\$<\\$<CONFIG:([^>]+)>:([^>]+)>$")
+ # The entry contains generator expression, so insert the definition into a definitions list
+ # corresponding to the config
+ string(TOUPPER ${CMAKE_MATCH_1} CONFIG)
+ set(ASM_DEFINITIONS_${CONFIG} ${ASM_DEFINITIONS_${CONFIG}} ${CMAKE_MATCH_2})
+ else()
+ list(APPEND ASM_DEFINITIONS ${DEFINITION})
+ endif()
+ endforeach()
+
+ # Add defines for the ASM. Unfortunately setting it on the target is ignored for asm by the cmake, so we have
+ # to set it on the sources.
+ set_property(SOURCE ${VM_SOURCES_WKS_ARCH_ASM} PROPERTY COMPILE_DEFINITIONS ${ASM_DEFINITIONS})
+ foreach(CONFIG IN LISTS CMAKE_CONFIGURATION_TYPES)
+ string(TOUPPER ${CONFIG} CONFIG)
+ set_property(SOURCE ${VM_SOURCES_WKS_ARCH_ASM} PROPERTY COMPILE_DEFINITIONS_${CONFIG} ${ASM_DEFINITIONS_${CONFIG}})
+ endforeach()
+
+ if (CLR_CMAKE_PLATFORM_ARCH_I386)
+ set_source_files_properties(${VM_SOURCES_WKS_ARCH_ASM} PROPERTIES COMPILE_FLAGS "/Zm /safeseh")
+ endif (CLR_CMAKE_PLATFORM_ARCH_I386)
+
+ # Convert AsmConstants.h into AsmConstants.inc
+ find_program(POWERSHELL powershell)
+ if (POWERSHELL STREQUAL "POWERSHELL-NOTFOUND")
+ message(FATAL_ERROR "POWERSHELL not found")
endif()
-endforeach()
-
-# Add defines for the ASM. Unfortunately setting it on the target is ignored for asm by the cmake, so we have
-# to set it on the sources.
-set_property(SOURCE ${VM_SOURCES_WKS_ARCH_ASM} PROPERTY COMPILE_DEFINITIONS ${ASM_DEFINITIONS})
-foreach(CONFIG IN LISTS CMAKE_CONFIGURATION_TYPES)
- string(TOUPPER ${CONFIG} CONFIG)
- set_property(SOURCE ${VM_SOURCES_WKS_ARCH_ASM} PROPERTY COMPILE_DEFINITIONS_${CONFIG} ${ASM_DEFINITIONS_${CONFIG}})
-endforeach()
-
-if (CLR_CMAKE_PLATFORM_ARCH_I386)
- set_source_files_properties(${VM_SOURCES_WKS_ARCH_ASM} PROPERTIES COMPILE_FLAGS "/Zm /safeseh")
-endif (CLR_CMAKE_PLATFORM_ARCH_I386)
-
-# Convert AsmConstants.h into AsmConstants.inc
-find_program(POWERSHELL powershell)
-if (POWERSHELL STREQUAL "POWERSHELL-NOTFOUND")
- message(FATAL_ERROR "POWERSHELL not found")
-endif()
-
-add_custom_command(
- # The AsmConstants.inc will be built in the pre-build phase of the cee_wks build
- TARGET cee_wks PRE_BUILD
- COMMAND ${POWERSHELL} -NoProfile -ExecutionPolicy Bypass -NonInteractive \"& \"\"${VM_DIR}/h2inc.ps1\"\"\" \"\"\"${VM_DIR}/${ARCH_SOURCES_DIR}/asmconstants.h\"\"\" >"${CMAKE_CURRENT_BINARY_DIR}/AsmConstants.tmp"
- COMMAND ${CMAKE_CXX_COMPILER} ${DEFINITIONS} /EP "${CMAKE_CURRENT_BINARY_DIR}/AsmConstants.tmp" >"${CMAKE_CURRENT_BINARY_DIR}/AsmConstants.inc"
-)
+
+ add_custom_command(
+ # The AsmConstants.inc will be built in the pre-build phase of the cee_wks build
+ TARGET cee_wks PRE_BUILD
+ COMMAND ${POWERSHELL} -NoProfile -ExecutionPolicy Bypass -NonInteractive \"& \"\"${VM_DIR}/h2inc.ps1\"\"\" \"\"\"${VM_DIR}/${ARCH_SOURCES_DIR}/asmconstants.h\"\"\" >"${CMAKE_CURRENT_BINARY_DIR}/AsmConstants.tmp"
+ COMMAND ${CMAKE_CXX_COMPILER} ${DEFINITIONS} /EP "${CMAKE_CURRENT_BINARY_DIR}/AsmConstants.tmp" >"${CMAKE_CURRENT_BINARY_DIR}/AsmConstants.inc"
+ )
+ endif(NOT CLR_CMAKE_PLATFORM_ARCH_ARM)
endif (WIN32)