summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruce Forstall <brucefo@microsoft.com>2017-03-02 09:14:52 -0800
committerBruce Forstall <brucefo@microsoft.com>2017-03-02 14:16:30 -0800
commitdb2c3f635d49cc3072ede8f39174459cd764fda4 (patch)
treec41898d9c5339661ad618c5e386772c932ff8211 /src
parent39b7281317201d4a5380fb6d57504ae9be598346 (diff)
downloadcoreclr-db2c3f635d49cc3072ede8f39174459cd764fda4.tar.gz
coreclr-db2c3f635d49cc3072ede8f39174459cd764fda4.tar.bz2
coreclr-db2c3f635d49cc3072ede8f39174459cd764fda4.zip
Build cross-compile altjits for arm32 and arm64
On x86, build an x86-host, arm32-target altjit. On amd64, build an amd64-host, arm64-target altjit. Each are named protononjit.dll, using our existing naming convention (proto for "prototype", nonjit meaning the code won't be executed). Use these via: ``` set COMPlus_AltJit=* set COMPlus_AltJitName=protononjit.dll ``` Of course, instead of `*`, you can use any function name. They are very useful for debugging the JIT in a "nicer" environment than the full native environment, especially if the full native environment isn't complete, or if the tools (such as debuggers, editors) are better in the cross environment than the native environment. These are only built on Windows. It might be possible to build them on Linux as well, but that will require some more build work.
Diffstat (limited to 'src')
-rw-r--r--src/jit/CMakeLists.txt135
-rw-r--r--src/jit/compatjit/CMakeLists.txt1
-rw-r--r--src/jit/crossgen/CMakeLists.txt2
-rw-r--r--src/jit/dll/CMakeLists.txt4
-rw-r--r--src/jit/legacyjit/CMakeLists.txt1
-rw-r--r--src/jit/protojit/CMakeLists.txt1
-rw-r--r--src/jit/protononjit/CMakeLists.txt73
-rw-r--r--src/jit/standalone/CMakeLists.txt1
8 files changed, 156 insertions, 62 deletions
diff --git a/src/jit/CMakeLists.txt b/src/jit/CMakeLists.txt
index ea2bf27ff5..c7c4f41ec3 100644
--- a/src/jit/CMakeLists.txt
+++ b/src/jit/CMakeLists.txt
@@ -12,6 +12,8 @@ if (CLR_CMAKE_TARGET_ARCH_AMD64 OR (CLR_CMAKE_TARGET_ARCH_I386 AND NOT CLR_CMAKE
add_definitions(-DFEATURE_AVX_SUPPORT)
endif ()
+# JIT_BUILD disables certain PAL_TRY debugging features
+add_definitions(-DJIT_BUILD=1)
if(WIN32)
set(JIT_RESOURCES Native.rc)
@@ -76,86 +78,93 @@ set( JIT_SOURCES
valuenum.cpp
)
-if(CLR_CMAKE_TARGET_ARCH_AMD64)
- set( ARCH_SOURCES
- codegenxarch.cpp
- emitxarch.cpp
- lowerxarch.cpp
- lsraxarch.cpp
- simd.cpp
- simdcodegenxarch.cpp
- targetamd64.cpp
- unwindamd64.cpp
- )
-elseif(CLR_CMAKE_TARGET_ARCH_ARM)
- set( ARCH_SOURCES
- codegenarm.cpp
- decomposelongs.cpp
- emitarm.cpp
- lowerarm.cpp
- lsraarm.cpp
- targetarm.cpp
- unwindarm.cpp
- )
-elseif(CLR_CMAKE_TARGET_ARCH_I386)
- set( ARCH_SOURCES
- codegenxarch.cpp
- decomposelongs.cpp
- emitxarch.cpp
- lowerxarch.cpp
- lsraxarch.cpp
- simd.cpp
- simdcodegenxarch.cpp
- targetx86.cpp
- unwindx86.cpp
- )
-elseif(CLR_CMAKE_TARGET_ARCH_ARM64)
- set( ARCH_SOURCES
- codegenarm64.cpp
- emitarm64.cpp
- lowerarm64.cpp
- lsraarm64.cpp
- targetarm64.cpp
- unwindarm.cpp
- unwindarm64.cpp
- )
-else()
- clr_unknown_arch()
-endif()
-
# The following defines all the source files used by the "legacy" back-end (#ifdef LEGACY_BACKEND).
# It is always safe to include both legacy and non-legacy files in the build, as everything is properly
# #ifdef'ed, though it makes the build slightly slower to do so. Note there is only a legacy backend for
# x86 and ARM.
-if(CLR_CMAKE_TARGET_ARCH_AMD64)
- set( ARCH_LEGACY_SOURCES
- )
-elseif(CLR_CMAKE_TARGET_ARCH_ARM)
- set( ARCH_LEGACY_SOURCES
+set(JIT_ARM_LEGACY_SOURCES
codegenlegacy.cpp
registerfp.cpp
- )
-elseif(CLR_CMAKE_TARGET_ARCH_I386)
- set( ARCH_LEGACY_SOURCES
+)
+set(JIT_I386_LEGACY_SOURCES
codegenlegacy.cpp
stackfp.cpp
- )
+)
+
+# Define all the architecture-specific source files
+
+set( JIT_AMD64_SOURCES
+ codegenxarch.cpp
+ emitxarch.cpp
+ lowerxarch.cpp
+ lsraxarch.cpp
+ simd.cpp
+ simdcodegenxarch.cpp
+ targetamd64.cpp
+ unwindamd64.cpp
+)
+
+set( JIT_ARM_SOURCES
+ ${JIT_ARM_LEGACY_SOURCES}
+ codegenarm.cpp
+ decomposelongs.cpp
+ emitarm.cpp
+ lowerarm.cpp
+ lsraarm.cpp
+ targetarm.cpp
+ unwindarm.cpp
+)
+
+set( JIT_I386_SOURCES
+ ${JIT_I386_LEGACY_SOURCES}
+ codegenxarch.cpp
+ decomposelongs.cpp
+ emitxarch.cpp
+ lowerxarch.cpp
+ lsraxarch.cpp
+ simd.cpp
+ simdcodegenxarch.cpp
+ targetx86.cpp
+ unwindx86.cpp
+)
+
+set( JIT_ARM64_SOURCES
+ codegenarm64.cpp
+ emitarm64.cpp
+ lowerarm64.cpp
+ lsraarm64.cpp
+ targetarm64.cpp
+ unwindarm.cpp
+ unwindarm64.cpp
+)
+
+if(CLR_CMAKE_TARGET_ARCH_AMD64)
+ set(JIT_ARCH_SOURCES ${JIT_AMD64_SOURCES})
+elseif(CLR_CMAKE_TARGET_ARCH_ARM)
+ set(JIT_ARCH_SOURCES ${JIT_ARM_SOURCES})
+elseif(CLR_CMAKE_TARGET_ARCH_I386)
+ set(JIT_ARCH_SOURCES ${JIT_I386_SOURCES})
elseif(CLR_CMAKE_TARGET_ARCH_ARM64)
- set( ARCH_LEGACY_SOURCES
- )
+ set(JIT_ARCH_SOURCES ${JIT_ARM64_SOURCES})
else()
clr_unknown_arch()
endif()
set( SOURCES
${JIT_SOURCES}
- ${ARCH_SOURCES}
- ${ARCH_LEGACY_SOURCES}
${JIT_RESOURCES}
)
convert_to_absolute_path(SOURCES ${SOURCES})
+convert_to_absolute_path(JIT_ARCH_SOURCES ${JIT_ARCH_SOURCES})
+
+# Also convert the per-architecture sources to absolute paths, if the subdirs want to use them.
+
+convert_to_absolute_path(JIT_AMD64_SOURCES ${JIT_AMD64_SOURCES})
+convert_to_absolute_path(JIT_ARM_SOURCES ${JIT_ARM_SOURCES})
+convert_to_absolute_path(JIT_I386_SOURCES ${JIT_I386_SOURCES})
+convert_to_absolute_path(JIT_ARM64_SOURCES ${JIT_ARM64_SOURCES})
if(WIN32)
add_precompiled_header(jitpch.h ../jitpch.cpp SOURCES)
@@ -212,6 +221,12 @@ if (CLR_CMAKE_PLATFORM_ARCH_ARM)
add_subdirectory(protojit)
endif (CLR_CMAKE_PLATFORM_ARCH_ARM)
+if ((CLR_CMAKE_PLATFORM_ARCH_I386 OR CLR_CMAKE_PLATFORM_ARCH_AMD64) AND WIN32)
+ # On x86, build RyuJIT/ARM32 cross-compiling altjit.
+ # On amd64, build RyuJIT/ARM64 cross-compiling altjit.
+ add_subdirectory(protononjit)
+endif ()
+
if (CLR_CMAKE_PLATFORM_ARCH_I386 AND WIN32)
add_subdirectory(legacyjit)
if (NOT CLR_BUILD_JIT32)
diff --git a/src/jit/compatjit/CMakeLists.txt b/src/jit/compatjit/CMakeLists.txt
index 1e0615e431..d70e61a8c2 100644
--- a/src/jit/compatjit/CMakeLists.txt
+++ b/src/jit/compatjit/CMakeLists.txt
@@ -22,6 +22,7 @@ endif(WIN32)
add_library_clr(compatjit
SHARED
${SHARED_LIB_SOURCES}
+ ${JIT_ARCH_SOURCES}
)
add_dependencies(compatjit jit_exports)
diff --git a/src/jit/crossgen/CMakeLists.txt b/src/jit/crossgen/CMakeLists.txt
index 6440e91a04..4d49a319b8 100644
--- a/src/jit/crossgen/CMakeLists.txt
+++ b/src/jit/crossgen/CMakeLists.txt
@@ -4,4 +4,4 @@ if(CLR_CMAKE_TARGET_ARCH_ARM)
add_definitions(-DLEGACY_BACKEND)
endif()
-add_library_clr(clrjit_crossgen ${SOURCES})
+add_library_clr(clrjit_crossgen ${SOURCES} ${JIT_ARCH_SOURCES})
diff --git a/src/jit/dll/CMakeLists.txt b/src/jit/dll/CMakeLists.txt
index 43ed07eae5..0e8f5bd3dd 100644
--- a/src/jit/dll/CMakeLists.txt
+++ b/src/jit/dll/CMakeLists.txt
@@ -11,11 +11,13 @@ if(CLR_CMAKE_PLATFORM_UNIX)
add_library_clr(clrjit_static
STATIC
${SHARED_LIB_SOURCES}
+ ${JIT_ARCH_SOURCES}
)
add_dependencies(clrjit_static coreclrpal gcinfo)
else()
add_library_clr(clrjit_static
- ${SOURCES}
+ ${SHARED_LIB_SOURCES}
+ ${JIT_ARCH_SOURCES}
)
# Disable up to here (see above) the following for UNIX altjit on Windows
# Enable the following for UNIX altjit on Windows
diff --git a/src/jit/legacyjit/CMakeLists.txt b/src/jit/legacyjit/CMakeLists.txt
index 73a4600a66..b5a44f6ef4 100644
--- a/src/jit/legacyjit/CMakeLists.txt
+++ b/src/jit/legacyjit/CMakeLists.txt
@@ -18,6 +18,7 @@ endif(WIN32)
add_library_clr(legacyjit
SHARED
${SHARED_LIB_SOURCES}
+ ${JIT_ARCH_SOURCES}
)
add_dependencies(legacyjit jit_exports)
diff --git a/src/jit/protojit/CMakeLists.txt b/src/jit/protojit/CMakeLists.txt
index 91c69e9a83..d27f30281a 100644
--- a/src/jit/protojit/CMakeLists.txt
+++ b/src/jit/protojit/CMakeLists.txt
@@ -13,6 +13,7 @@ endif(WIN32)
add_library_clr(protojit
SHARED
${SHARED_LIB_SOURCES}
+ ${JIT_ARCH_SOURCES}
)
add_dependencies(protojit jit_exports)
diff --git a/src/jit/protononjit/CMakeLists.txt b/src/jit/protononjit/CMakeLists.txt
new file mode 100644
index 0000000000..ed6932e9a2
--- /dev/null
+++ b/src/jit/protononjit/CMakeLists.txt
@@ -0,0 +1,73 @@
+project(protononjit)
+
+add_definitions(-DALT_JIT)
+add_definitions(-DFEATURE_NO_HOST)
+add_definitions(-DSELF_NO_HOST)
+add_definitions(-DFEATURE_READYTORUN_COMPILER)
+remove_definitions(-DFEATURE_MERGE_JIT_AND_ENGINE)
+
+remove_definitions(-DFEATURE_SIMD)
+remove_definitions(-DFEATURE_AVX_SUPPORT)
+
+if (CLR_CMAKE_PLATFORM_ARCH_I386)
+ remove_definitions(-D_TARGET_X86_=1)
+ add_definitions(-D_TARGET_ARM_)
+ set(JIT_ARCH_ALTJIT_SOURCES ${JIT_ARM_SOURCES})
+elseif(CLR_CMAKE_PLATFORM_ARCH_AMD64)
+ remove_definitions(-D_TARGET_AMD64_=1)
+ add_definitions(-D_TARGET_ARM64_)
+ set(JIT_ARCH_ALTJIT_SOURCES ${JIT_ARM64_SOURCES})
+else()
+ clr_unknown_arch()
+endif()
+
+if(WIN32)
+ add_definitions(-DFX_VER_INTERNALNAME_STR=protononjit.dll)
+endif(WIN32)
+
+add_library_clr(protononjit
+ SHARED
+ ${SHARED_LIB_SOURCES}
+ ${JIT_ARCH_ALTJIT_SOURCES}
+)
+
+add_dependencies(protononjit jit_exports)
+
+set_property(TARGET protononjit APPEND_STRING PROPERTY LINK_FLAGS ${JIT_EXPORTS_LINKER_OPTION})
+set_property(TARGET protononjit APPEND_STRING PROPERTY LINK_DEPENDS ${JIT_EXPORTS_FILE})
+
+set(RYUJIT_LINK_LIBRARIES
+ utilcodestaticnohost
+ gcinfo
+)
+
+if(CLR_CMAKE_PLATFORM_UNIX)
+ list(APPEND RYUJIT_LINK_LIBRARIES
+ mscorrc_debug
+ coreclrpal
+ palrt
+ )
+else()
+ list(APPEND RYUJIT_LINK_LIBRARIES
+ ${STATIC_MT_CRT_LIB}
+ ${STATIC_MT_VCRT_LIB}
+ kernel32.lib
+ advapi32.lib
+ ole32.lib
+ oleaut32.lib
+ uuid.lib
+ user32.lib
+ version.lib
+ shlwapi.lib
+ bcrypt.lib
+ crypt32.lib
+ RuntimeObject.lib
+ )
+endif(CLR_CMAKE_PLATFORM_UNIX)
+
+target_link_libraries(protononjit
+ ${RYUJIT_LINK_LIBRARIES}
+)
+
+# add the install targets
+install_clr(protononjit)
diff --git a/src/jit/standalone/CMakeLists.txt b/src/jit/standalone/CMakeLists.txt
index f20d3790c7..988108efb1 100644
--- a/src/jit/standalone/CMakeLists.txt
+++ b/src/jit/standalone/CMakeLists.txt
@@ -16,6 +16,7 @@ endif(WIN32)
add_library_clr(clrjit
SHARED
${SHARED_LIB_SOURCES}
+ ${JIT_ARCH_SOURCES}
)
add_dependencies(clrjit jit_exports)