[RyuJIT/armel] cross build armel on x86 host.
authorAlexander Soldatov <soldatov.a@samsung.com>
Fri, 13 Oct 2017 16:14:35 +0000 (19:14 +0300)
committerAlexander Soldatov <soldatov.a@samsung.com>
Tue, 17 Oct 2017 09:46:57 +0000 (12:46 +0300)
Compile ARM soft-fp version of libclrjit.so on x86 platform.
For running cross-jit execute as:
COMPlus_AltJit=* COMPlus_AltJitName=libprotononjit.so ./corerun ...

Commit migrated from https://github.com/dotnet/coreclr/commit/f9f07369e68787c15c09814cbb2e2bbc49ca3f52

src/coreclr/src/jit/CMakeLists.txt
src/coreclr/src/jit/DIRS.proj
src/coreclr/src/jit/armelnonjit/.gitmirror [new file with mode: 0644]
src/coreclr/src/jit/armelnonjit/CMakeLists.txt [new file with mode: 0644]
src/coreclr/src/jit/armelnonjit/SOURCES [new file with mode: 0644]
src/coreclr/src/jit/armelnonjit/armelnonjit.def [new file with mode: 0644]
src/coreclr/src/jit/armelnonjit/armelnonjit.nativeproj [new file with mode: 0644]
src/coreclr/src/jit/armelnonjit/makefile [new file with mode: 0644]

index bf5fdaa..5b92329 100644 (file)
@@ -260,6 +260,11 @@ if (CLR_CMAKE_PLATFORM_ARCH_I386 OR CLR_CMAKE_PLATFORM_ARCH_AMD64)
     add_subdirectory(protononjit)
 endif ()
 
+if (CLR_CMAKE_PLATFORM_ARCH_I386)
+     # On x86, build RyuJIT/ARM32 cross-compiling altjit for ARM_SOFTFP (armel).
+    add_subdirectory(armelnonjit)
+endif ()
+
 if ((CLR_CMAKE_PLATFORM_ARCH_I386 OR CLR_CMAKE_PLATFORM_ARCH_AMD64) AND WIN32)
     # On Windows, build altjit that targets the Linux ABI:
     #   On x86, build Linux/x86 altjit. This enables UNIX_X86_ABI.
index 539743c..b09e433 100644 (file)
@@ -39,6 +39,7 @@
     <ProjectFile Condition="'$(BuildArchitecture)' == 'amd64'" Include="arm64altjit\arm64altjit.nativeproj" />
     <ProjectFile Condition="'$(BuildArchitecture)' == 'i386'"  Include="protojit\protojit.nativeproj" />
     <ProjectFile Condition="'$(BuildArchitecture)' == 'i386'"  Include="protononjit\protononjit.nativeproj" />
+    <!-- <ProjectFile Condition="'$(BuildArchitecture)' == 'i386'"  Include="armelnonjit\armelnonjit.nativeproj" /> -->
   </ItemGroup>
 
   <!--Import the targets-->
diff --git a/src/coreclr/src/jit/armelnonjit/.gitmirror b/src/coreclr/src/jit/armelnonjit/.gitmirror
new file mode 100644 (file)
index 0000000..f507630
--- /dev/null
@@ -0,0 +1 @@
+Only contents of this folder, excluding subfolders, will be mirrored by the Git-TFS Mirror. 
\ No newline at end of file
diff --git a/src/coreclr/src/jit/armelnonjit/CMakeLists.txt b/src/coreclr/src/jit/armelnonjit/CMakeLists.txt
new file mode 100644 (file)
index 0000000..20a124a
--- /dev/null
@@ -0,0 +1,89 @@
+project(armelnonjit)
+
+add_definitions(-DALT_JIT)
+add_definitions(-DFEATURE_NO_HOST)
+add_definitions(-DSELF_NO_HOST)
+remove_definitions(-DFEATURE_MERGE_JIT_AND_ENGINE)
+
+remove_definitions(-DFEATURE_SIMD)
+
+if(FEATURE_READYTORUN)
+  add_definitions(-DFEATURE_READYTORUN_COMPILER)
+endif(FEATURE_READYTORUN)
+
+if (CLR_CMAKE_PLATFORM_ARCH_I386)
+    remove_definitions(-D_TARGET_X86_=1)
+    add_definitions(-D_TARGET_ARM_)
+    add_definitions(-DARM_SOFTFP=1)
+    set(JIT_ARCH_ALTJIT_SOURCES ${JIT_ARM_SOURCES})
+    set(JIT_ARCH_LINK_LIBRARIES gcinfo_arm)
+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})
+    set(JIT_ARCH_LINK_LIBRARIES gcinfo_arm64)
+else()
+    clr_unknown_arch()
+endif()
+
+if (NOT WIN32)
+    if (CLR_CMAKE_PLATFORM_ARCH_I386)
+        remove_definitions(-DUNIX_X86_ABI)
+    elseif(CLR_CMAKE_PLATFORM_ARCH_AMD64)
+        remove_definitions(-DUNIX_AMD64_ABI)
+        remove_definitions(-DFEATURE_UNIX_AMD64_STRUCT_PASSING)
+    else()
+        clr_unknown_arch()
+    endif()
+endif(NOT WIN32)
+
+if(WIN32)
+  add_definitions(-DFX_VER_INTERNALNAME_STR=armelnonjit.dll)
+endif(WIN32)
+
+add_library_clr(armelnonjit
+   SHARED
+   ${SHARED_LIB_SOURCES}
+   ${JIT_ARCH_ALTJIT_SOURCES}
+)
+
+add_dependencies(armelnonjit jit_exports)
+
+set_property(TARGET armelnonjit APPEND_STRING PROPERTY LINK_FLAGS ${JIT_EXPORTS_LINKER_OPTION})
+set_property(TARGET armelnonjit APPEND_STRING PROPERTY LINK_DEPENDS ${JIT_EXPORTS_FILE})
+
+set(RYUJIT_LINK_LIBRARIES
+   utilcodestaticnohost
+   ${JIT_ARCH_LINK_LIBRARIES}
+)
+
+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(armelnonjit
+   ${RYUJIT_LINK_LIBRARIES}
+)
+
+# add the install targets
+install_clr(armelnonjit)
diff --git a/src/coreclr/src/jit/armelnonjit/SOURCES b/src/coreclr/src/jit/armelnonjit/SOURCES
new file mode 100644 (file)
index 0000000..d0c01e7
--- /dev/null
@@ -0,0 +1,10 @@
+
+#
+# DO NOT EDIT THIS FILE!!! Modify the project file in this directory
+# This file merely allows the MSBuild project file in this directory to be integrated with Build.Exe
+#
+TARGETTYPE=NOTARGET
+CLR_TARGETTYPE=DLL
+MSBuildProjectFile=armelnonjit.nativeproj
+SOURCES=
+    
\ No newline at end of file
diff --git a/src/coreclr/src/jit/armelnonjit/armelnonjit.def b/src/coreclr/src/jit/armelnonjit/armelnonjit.def
new file mode 100644 (file)
index 0000000..1603af7
--- /dev/null
@@ -0,0 +1,7 @@
+; Licensed to the .NET Foundation under one or more agreements.
+; The .NET Foundation licenses this file to you under the MIT license.
+; See the LICENSE file in the project root for more information.
+EXPORTS
+    getJit
+    jitStartup
+    sxsJitStartup
diff --git a/src/coreclr/src/jit/armelnonjit/armelnonjit.nativeproj b/src/coreclr/src/jit/armelnonjit/armelnonjit.nativeproj
new file mode 100644 (file)
index 0000000..e5d598a
--- /dev/null
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+
+  <!--
+      PROTO JIT: The purpose of this module is to provide an isolated environment to develop
+      the RyuJIT backend without interfering with the development of the frontend.  The
+      idea is to fork codegen and registerfp, that way we leave the PUCLR backend intact so 
+      it can be still consumed by the RyuJIT frontend separately maintaining the code stability 
+      of the PUCLR codegen.cpp logic.
+
+      This module is meant to be used as a throwaway or fallback cross-JIT (x86 -> arm) that will just
+      attempt to generate arm code, throw it away and then re-jit using the default jit on x86.
+  -->
+
+  <!--
+      Note that we are defining TargetArch directly because of altjit is not a real fully functional cross 
+      compiled binary. It is just a convenience workaround for JIT devs.
+  -->
+  <PropertyGroup>
+    <TargetArch>arm</TargetArch>
+  </PropertyGroup>
+
+  <!-- Import the CLR's settings -->
+
+  <Import Project="$(_NTDRIVE)$(_NTROOT)\ndp\clr\clr.props" />
+
+  <PropertyGroup>
+
+    <!-- Set the output -->
+
+    <OutputName>armelnonjit</OutputName>
+    <FeatureMergeJitAndEngine>false</FeatureMergeJitAndEngine>
+    <TargetType>DYNLINK</TargetType>
+    <BuildCoreBinaries>false</BuildCoreBinaries>
+    <BuildSysBinaries>false</BuildSysBinaries>
+
+    <!-- Motherhood & apple pie here -->
+
+    <DllEntryPoint>_DllMainCRTStartup</DllEntryPoint>
+    <LinkSubsystem>windows</LinkSubsystem>
+    <LibCLib Condition="'$(FeatureMergeJitAndEngine)'!='true'">$(ClrCrtLib)</LibCLib>
+
+    <!-- JIT specific baloney -->
+
+    <LinkModuleDefinitionFile>$(OutputName).def</LinkModuleDefinitionFile>
+
+    <ClDefines>$(ClDefines);_TARGET_ARM_=1</ClDefines>
+    <ClDefines>$(ClDefines);ALT_JIT</ClDefines>
+
+    <Win32DllLibs>$(SdkLibPath)\kernel32.lib;$(SdkLibPath)\user32.lib;$(SdkLibPath)\advapi32.lib;$(SdkLibPath)\oleaut32.lib;$(SdkLibPath)\uuid.lib</Win32DllLibs>
+    <Win32DllLibs>$(Win32DllLibs);$(ClrLibPath)\utilcode.lib</Win32DllLibs>
+
+    <!-- Profile-guided optimization -->
+
+    <PogoOptimize>false</PogoOptimize>
+    <PogoInstrument>false</PogoInstrument>
+    <PogoUpdate>false</PogoUpdate>
+
+    <!-- Do we want to build with msvcdis disassembly? This should be enabled for DEBUG, disabled otherwise.
+         However, it can be useful to enable it temporarily in non-DEBUG builds, by changing the EnableLateDisasm property.
+    -->
+    <EnableLateDisasm>false</EnableLateDisasm>
+    <ClDefines Condition="'$(EnableLateDisasm)' == 'true'">$(ClDefines);LATE_DISASM=1</ClDefines>
+    <LinkDelayLoad Condition="'$(EnableLateDisasm)' == 'true'">$(LinkDelayLoad);msvcdis$(VC_NONCRT_ProdVerX).dll</LinkDelayLoad>
+    <UseDelayimpLib Condition="'$(EnableLateDisasm)' == 'true' and '$(FeatureMergeJitAndEngine)'!='true'">true</UseDelayimpLib>
+
+  </PropertyGroup>
+
+  <!-- Leaf Project Items -->
+  <ItemGroup>
+    <ProjectReference Include="$(ClrSrcDirectory)utilcode\dyncrt\dyncrt.nativeproj" />
+    <TargetLib Include="$(SdkLibPath)\mscoree.lib" />
+    <TargetLib Include="$(ClrLibPath)\ArmGCInfo.lib">
+      <ProjectReference>$(ClrSrcDirectory)gcinfo\armlib\ArmGCInfo.nativeproj</ProjectReference>
+    </TargetLib>
+    <TargetLib Condition="'$(UseDelayimpLib)' == 'true'" Include="$(ClrLibPath)\delayimp.lib">
+      <ProjectReference>$(ClrSrcDirectory)delayimp\delayimp.nativeproj</ProjectReference>
+    </TargetLib>
+    <TargetLib Condition="'$(DebugBuild)' == 'true'" Include="$(SdkLibPath)\ole32.lib" />
+    <TargetLib Condition="'$(EnableLateDisasm)' == 'true'" Include="$(VCToolsLibPath)\msvcdis.lib" />
+    <RCResourceFile Include="..\native.rc" />
+  </ItemGroup>
+
+  <Import Project="..\jit.settings.targets" />
+
+</Project>
diff --git a/src/coreclr/src/jit/armelnonjit/makefile b/src/coreclr/src/jit/armelnonjit/makefile
new file mode 100644 (file)
index 0000000..bf27e8c
--- /dev/null
@@ -0,0 +1,7 @@
+
+#
+# DO NOT EDIT THIS FILE!!! Modify the project file in this directory
+# This file merely allows the MSBuild project file in this directory to be integrated with Build.Exe
+#
+
+!INCLUDE $(NTMAKEENV)\devdiv.def