This has following changes:
authorRahul Kumar <rahku@microsoft.com>
Tue, 19 Apr 2016 21:22:23 +0000 (14:22 -0700)
committerRahul Kumar <rahku@microsoft.com>
Tue, 26 Apr 2016 17:12:06 +0000 (10:12 -0700)
1. Update arm64 toolset to latest.
2. Link against ucrt.
3. Fix tls offsets which have changed due to updated toolset
4. Fix source code in decimal.cpp to avoid integer overflow. Result of signed integer overlfow is undefined in C++.
5. Enable build of sos which can be loaded in arm64 windbg
6. Add nop to empty assembly marker methods as new toolset generates invalid .pdata for them.

15 files changed:
CMakeLists.txt
build.cmd
compileoptions.cmake
netci.groovy
src/ToolBox/SOS/CMakeLists.txt
src/ToolBox/SOS/Strike/CMakeLists.txt
src/classlibnative/bcltype/decimal.cpp
src/dlls/dbgshim/CMakeLists.txt
src/dlls/mscordac/CMakeLists.txt
src/dlls/mscordbi/CMakeLists.txt
src/inc/tls.h
src/tools/GenClrDebugResource/CMakeLists.txt
src/tools/InjectResource/CMakeLists.txt
src/vm/arm64/crthelpers.asm
tests/buildtest.cmd

index 17103269da90b9747b6f57c12718be85f223b1d7..f1057178ef5ef03d8403ca7455c0f19b2b021e67 100644 (file)
@@ -293,14 +293,14 @@ if (WIN32)
     set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /machine:arm64")
     set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /machine:arm64")
     set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /machine:arm64")
-  else()
-    # Force uCRT to be dynamically linked for Release build  
-    set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib")  
-    set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib")  
-    set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO} /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib")  
-    set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib")  
   endif(CLR_CMAKE_PLATFORM_ARCH_ARM64)
 
+  # Force uCRT to be dynamically linked for Release build  
+  set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib")  
+  set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib")  
+  set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO} /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib")  
+  set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib")  
+
 elseif (CLR_CMAKE_PLATFORM_UNIX)
   # Set the values to display when interactively configuring CMAKE_BUILD_TYPE
   set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "DEBUG;CHECKED;RELEASE;RELWITHDEBINFO")
@@ -422,23 +422,14 @@ if (CLR_CMAKE_PLATFORM_UNIX)
 endif(CLR_CMAKE_PLATFORM_UNIX)
 
 if (WIN32)
-
-  # ARM64_TODO: Enable this for Windows Arm64
-  if (NOT CLR_CMAKE_PLATFORM_ARCH_ARM64)
-    # Define the CRT lib references that link into Desktop imports
-    set(STATIC_MT_CRT_LIB  "libcmt$<$<OR:$<CONFIG:Debug>,$<CONFIG:Checked>>:d>.lib")
-    set(STATIC_MT_VCRT_LIB  "libvcruntime$<$<OR:$<CONFIG:Debug>,$<CONFIG:Checked>>:d>.lib")
-    set(STATIC_MT_CPP_LIB  "libcpmt$<$<OR:$<CONFIG:Debug>,$<CONFIG:Checked>>:d>.lib")
-
-    # Define the uCRT lib reference
-    set(STATIC_UCRT_LIB  "libucrt$<$<OR:$<CONFIG:Debug>,$<CONFIG:Checked>>:d>.lib")
-    set(DYNAMIC_UCRT_LIB  "ucrt$<$<OR:$<CONFIG:Debug>,$<CONFIG:Checked>>:d>.lib")
-  else()
-    # On Arm64, we will still use the legacy libraries for linking.
-    set(STATIC_MT_CRT_LIB  "msvcrt.lib")
-    set(STATIC_MT_CPP_LIB  "libcpmt$<$<OR:$<CONFIG:Debug>,$<CONFIG:Checked>>:d>.lib")
-  endif()
-
+  # Define the CRT lib references that link into Desktop imports
+  set(STATIC_MT_CRT_LIB  "libcmt$<$<OR:$<CONFIG:Debug>,$<CONFIG:Checked>>:d>.lib")
+  set(STATIC_MT_VCRT_LIB  "libvcruntime$<$<OR:$<CONFIG:Debug>,$<CONFIG:Checked>>:d>.lib")
+  set(STATIC_MT_CPP_LIB  "libcpmt$<$<OR:$<CONFIG:Debug>,$<CONFIG:Checked>>:d>.lib")
+
+  # Define the uCRT lib reference
+  set(STATIC_UCRT_LIB  "libucrt$<$<OR:$<CONFIG:Debug>,$<CONFIG:Checked>>:d>.lib")
+  set(DYNAMIC_UCRT_LIB  "ucrt$<$<OR:$<CONFIG:Debug>,$<CONFIG:Checked>>:d>.lib")
 endif(WIN32)
 
 # Architecture specific files folder name
index a9b73a0d964b8f937bbb3c33e9bc262e23a67e47..5665e3e5680bb17e2ceb4a8cea72ff408b3b064d 100644 (file)
--- a/build.cmd
+++ b/build.cmd
@@ -708,12 +708,17 @@ if /i "%__ToolsetDir%" == "" (
     exit /b 1
 )
 
-set PATH=%__ToolsetDir%\cpp\bin;%PATH%
-set LIB=%__ToolsetDir%\cpp\libWin9CoreSystem;%__ToolsetDir%\OS\lib;%__ToolsetDir%\cpp\lib
+set PATH=%__ToolsetDir%\VC_sdk\bin;%PATH%
+set LIB=%__ToolsetDir%\VC_sdk\lib\arm64;%__ToolsetDir%\sdpublic\sdk\lib\arm64
 set INCLUDE=^
-%__ToolsetDir%\cpp\inc;^
-%__ToolsetDir%\OS\inc\Windows;^
-%__ToolsetDir%\OS\inc\Windows\crt;^
-%__ToolsetDir%\cpp\inc\vc;^
-%__ToolsetDir%\OS\inc\win8
+%__ToolsetDir%\VC_sdk\inc;^
+%__ToolsetDir%\sdpublic\sdk\inc;^
+%__ToolsetDir%\sdpublic\shared\inc;^
+%__ToolsetDir%\sdpublic\shared\inc\minwin;^
+%__ToolsetDir%\sdpublic\sdk\inc\ucrt;^
+%__ToolsetDir%\sdpublic\sdk\inc\minwin;^
+%__ToolsetDir%\sdpublic\sdk\inc\mincore;^
+%__ToolsetDir%\sdpublic\sdk\inc\abi;^
+%__ToolsetDir%\sdpublic\sdk\inc\clientcore;^
+%__ToolsetDir%\diasdk\include
 exit /b 0
index 4ec51d3ad2def4bcac91ccc6d7db280d471dbfa1..739b1a214ccb0b40a42c97e42001328bdc8ad431 100644 (file)
@@ -96,19 +96,18 @@ if (WIN32)
   add_compile_options($<$<CONFIG:Debug>:/homeparams>) # Force parameters passed in registers to be written to the stack
   endif (CLR_CMAKE_PLATFORM_ARCH_AMD64)
 
-  if(NOT CLR_CMAKE_PLATFORM_ARCH_ARM64)
-    # enable control-flow-guard support for native components for non-Arm64 builds
-    add_compile_options(/guard:cf) 
-
-    # Statically linked CRT (libcmt[d].lib, libvcruntime[d].lib and libucrt[d].lib) by default. This is done to avoid  
-    # linking in VCRUNTIME140.DLL for a simplified xcopy experience by reducing the dependency on VC REDIST.  
-    #  
-    # For Release builds, we shall dynamically link into uCRT [ucrtbase.dll] (which is pushed down as a Windows Update on downlevel OS) but  
-    # wont do the same for debug/checked builds since ucrtbased.dll is not redistributable and Debug/Checked builds are not  
-    # production-time scenarios.  
-    add_compile_options($<$<OR:$<CONFIG:Release>,$<CONFIG:Relwithdebinfo>>:/MT>)  
-    add_compile_options($<$<OR:$<CONFIG:Debug>,$<CONFIG:Checked>>:/MTd>)  
-  endif (NOT CLR_CMAKE_PLATFORM_ARCH_ARM64)
+  # enable control-flow-guard support for native components for non-Arm64 builds
+  add_compile_options(/guard:cf) 
+
+  # Statically linked CRT (libcmt[d].lib, libvcruntime[d].lib and libucrt[d].lib) by default. This is done to avoid  
+  # linking in VCRUNTIME140.DLL for a simplified xcopy experience by reducing the dependency on VC REDIST.  
+  #  
+  # For Release builds, we shall dynamically link into uCRT [ucrtbase.dll] (which is pushed down as a Windows Update on downlevel OS) but  
+  # wont do the same for debug/checked builds since ucrtbased.dll is not redistributable and Debug/Checked builds are not  
+  # production-time scenarios.  
+  add_compile_options($<$<OR:$<CONFIG:Release>,$<CONFIG:Relwithdebinfo>>:/MT>)  
+  add_compile_options($<$<OR:$<CONFIG:Debug>,$<CONFIG:Checked>>:/MTd>)  
+
 endif (WIN32)
 
 if(CMAKE_ENABLE_CODE_COVERAGE)
index bb06d6b47b7cd562f9ea229d6d2c67a6d79bba8d..f8f5b9714d5e305f8b46814324406097817f03f6 100755 (executable)
@@ -1198,10 +1198,10 @@ combinedScenarios.each { scenario ->
 
                                     // Debug runs take too long to run. So build job only.
                                     if (lowerConfiguration == "debug") {
-                                       buildCommands += "set __TestIntermediateDir=int&&build.cmd ${lowerConfiguration} ${architecture} /toolset_dir C:\\ats"
+                                       buildCommands += "set __TestIntermediateDir=int&&build.cmd ${lowerConfiguration} ${architecture} /toolset_dir C:\\ats2"
                                     }
                                     else {
-                                       buildCommands += "set __TestIntermediateDir=int&&build.cmd skiptests ${lowerConfiguration} ${architecture} /toolset_dir C:\\ats"
+                                       buildCommands += "set __TestIntermediateDir=int&&build.cmd skiptests ${lowerConfiguration} ${architecture} /toolset_dir C:\\ats2"
                                        // Test build and run are launched together.
                                        buildCommands += "Z:\\arm64\\common\\scripts\\arm64PostLauncher.cmd %WORKSPACE% ${architecture} ${lowerConfiguration}"
                                        Utilities.addXUnitDotNETResults(newJob, 'bin/tests/testResults.xml')
index f48f3a70c147437130887895113ba18cf0996e3d..9380dc1de6fd5a09bea750bd787943913e74d6b8 100644 (file)
@@ -1,5 +1,3 @@
 if(WIN32)
-if(NOT DEFINED CLR_CMAKE_PLATFORM_ARCH_ARM64)
     add_subdirectory(Strike)
-endif(NOT DEFINED CLR_CMAKE_PLATFORM_ARCH_ARM64)
 endif(WIN32)
index 124fe979b3e5eee6e6530d72f01b603318f8d833..36893b1e421d3f1df2c11ec58db1f5bee8f5b132 100644 (file)
@@ -85,6 +85,7 @@ if(WIN32)
     dbgutil
     ${STATIC_MT_CRT_LIB}
     ${STATIC_MT_CPP_LIB}
+    ${STATIC_MT_VCRT_LIB}
     kernel32.lib
     user32.lib
     ole32.lib
@@ -96,14 +97,6 @@ if(WIN32)
     psapi.lib
     ntdll.lib
   )
-
-  # ARM64_TODO: Enable this for Windows Arm64
-  if (NOT CLR_CMAKE_PLATFORM_ARCH_ARM64)
-      list(APPEND SOS_LIBRARY 
-        ${STATIC_MT_VCRT_LIB}
-      )
-  endif()
-    
 else(WIN32)
   add_definitions(-DFEATURE_ENABLE_HARDWARE_EXCEPTIONS)
   add_definitions(-DPAL_STDCPP_COMPAT=1)
index 85743dc3d032b3e4377c3cabb63b19b29816e838..ed63391e542afbdf65004618ff532f62dd5b343f 100644 (file)
@@ -246,6 +246,10 @@ FCIMPL1(INT32, COMDecimal::ToInt32, FC_DECIMAL d)
             if (i >= 0) return i;
         }
         else {
+            // Int32.MinValue is represented as sign being negative
+            // and Lo32 being 0x80000000 (-ve number). Return that as is without
+            // reversing the sign of the number.
+            if(i == 0x80000000) return i;
             i = -i;
             if (i <= 0) return i;
         }
index c3ebaf5d062253274eb508493bf7b500fee07d42..5024642ca56062f10f4ea1138b88120d54787599 100644 (file)
@@ -44,6 +44,7 @@ if(WIN32)
     list(APPEND DBGSHIM_LIBRARIES
         kernel32.lib
         ${STATIC_MT_CRT_LIB}
+        ${STATIC_MT_VCRT_LIB}
         uuid.lib
         user32.lib
         advapi32.lib
@@ -52,14 +53,6 @@ if(WIN32)
         version.lib
         psapi.lib
     )
-
-    # ARM64_TODO: Enable this for Windows Arm64
-    if (NOT CLR_CMAKE_PLATFORM_ARCH_ARM64)
-        list(APPEND DBGSHIM_LIBRARIES 
-            ${STATIC_MT_VCRT_LIB}
-        )
-    endif()
-  
 else()
     list(APPEND DBGSHIM_LIBRARIES
         coreclrpal
index 4a80ef46e78844c1ba03062adfe402f06055fbfd..8c2cec1b8127530b870aceb1019444f47450d6cf 100644 (file)
@@ -86,15 +86,8 @@ if(WIN32)
         uuid.lib
         user32.lib
         ${STATIC_MT_CRT_LIB}
+        ${STATIC_MT_VCRT_LIB}
     )
-
-    # ARM64_TODO: Enable this for Windows Arm64
-    if (NOT CLR_CMAKE_TARGET_ARCH_ARM64)
-        list(APPEND COREDAC_LIBRARIES 
-          ${STATIC_MT_VCRT_LIB}
-        )
-    endif()
-
 else(WIN32)
     list(APPEND COREDAC_LIBRARIES
         mscorrc_debug
index b8dfa71ca617ef8719db5dc77e082635f9cdf513..28b006b58c32cc85d306d6a33dc7665443b7df8f 100644 (file)
@@ -62,15 +62,9 @@ if(WIN32)
         user32.lib
         version.lib
         ${STATIC_MT_CRT_LIB}
+        ${STATIC_MT_VCRT_LIB}
     )
 
-    # ARM64_TODO: Enable this for Windows Arm64
-    if (NOT CLR_CMAKE_PLATFORM_ARCH_ARM64)
-        list(APPEND COREDBI_LIBRARIES 
-          ${STATIC_MT_VCRT_LIB}
-        )
-    endif()
-
     target_link_libraries(mscordbi ${COREDBI_LIBRARIES})
 
 elseif(CLR_CMAKE_PLATFORM_UNIX)
index 05e50575f4c56350cb2a56b048255e115b2ad88b..55f74892bb5f8b91bd32f75bc46b586b9e87af81 100644 (file)
 
 #ifdef FEATURE_IMPLICIT_TLS
 #ifdef _WIN64
-#define OFFSETOF__TLS__tls_CurrentThread            0x08
-#define OFFSETOF__TLS__tls_EETlsData                0x18
-#else
-#define OFFSETOF__TLS__tls_CurrentThread            0x04
-#define OFFSETOF__TLS__tls_EETlsData                0x0c
+#ifndef _DEBUG
+#define OFFSETOF__TLS__tls_ThreadLocalInfo 0x10
+#else // _DEBUG
+#define OFFSETOF__TLS__tls_ThreadLocalInfo 0x08
+#endif // _DEBUG
+#else // _WIN64
+#define OFFSETOF__TLS__tls_ThreadLocalInfo 0x04
 #endif // _WIN64
 
+#define OFFSETOF__TLS__tls_CurrentThread         (OFFSETOF__TLS__tls_ThreadLocalInfo+0x0)
+#define OFFSETOF__TLS__tls_EETlsData             (OFFSETOF__TLS__tls_CurrentThread+2*sizeof(void*))
+
+
 #ifdef _TARGET_WIN64_
 #define WINNT_OFFSETOF__TEB__ThreadLocalStoragePointer  0x58
 #else
index c30f391440172718fc33021fb09ed43022076d1f..ad2598a373c96acb6c0b389604a81f53b10ecbb3 100644 (file)
@@ -3,9 +3,5 @@ add_executable(GenClrDebugResource GenClrDebugResource.cpp)
 
 target_link_libraries(GenClrDebugResource
     ${STATIC_MT_CRT_LIB}
+    ${STATIC_MT_VCRT_LIB}
 )
-
-# ARM64_TODO: Enable this for Windows Arm64
-if (NOT CLR_CMAKE_PLATFORM_ARCH_ARM64)
-       target_link_libraries(GenClrDebugResource ${STATIC_MT_VCRT_LIB})
-endif()
\ No newline at end of file
index f8593069ab286f5ac55bc19608145ad3c22062ff..a4fd53866200e5b4ca3ac136dd74bf6018cd65f9 100644 (file)
@@ -6,9 +6,5 @@ add_executable(InjectResource InjectResource.cpp)
 
 target_link_libraries(InjectResource
     ${STATIC_MT_CRT_LIB}
-)
-
-# ARM64_TODO: Enable this for Windows Arm64
-if (NOT CLR_CMAKE_PLATFORM_ARCH_ARM64)
-    target_link_libraries(InjectResource ${STATIC_MT_VCRT_LIB})
-endif()
\ No newline at end of file
+    ${STATIC_MT_VCRT_LIB}
+)
\ No newline at end of file
index 127b3e40fb20dc9f473dff23b1860dcbf31c5629..a341dc40277a0b0623b488bc039551c96fce35c0 100644 (file)
@@ -153,6 +153,7 @@ JIT_MemSet_0xd8
     LEAF_END
 
     LEAF_ENTRY JIT_MemSet_End
+    nop
     LEAF_END
 
 
@@ -292,6 +293,7 @@ JIT_MemCpy_0xe8
     LEAF_END
 
     LEAF_ENTRY JIT_MemCpy_End
+    nop
     LEAF_END
 
 ; Must be at very end of file
index 8f23e829d88db649c02594a40d11d6b27c8b5ece..1478181946b1dfb52dc3f4035881a94c2b03a549 100644 (file)
@@ -397,12 +397,17 @@ if /i "%__ToolsetDir%" == "" (
     exit /b 1
 )
 
-set PATH=%__ToolsetDir%\cpp\bin;%PATH%
-set LIB=%__ToolsetDir%\cpp\libWin9CoreSystem;%__ToolsetDir%\OS\lib;%__ToolsetDir%\cpp\lib
+set PATH=%__ToolsetDir%\VC_sdk\bin;%PATH%
+set LIB=%__ToolsetDir%\VC_sdk\lib\arm64;%__ToolsetDir%\sdpublic\sdk\lib\arm64
 set INCLUDE=^
-%__ToolsetDir%\cpp\inc;^
-%__ToolsetDir%\OS\inc\Windows;^
-%__ToolsetDir%\OS\inc\Windows\crt;^
-%__ToolsetDir%\cpp\inc\vc;^
-%__ToolsetDir%\OS\inc\win8
+%__ToolsetDir%\VC_sdk\inc;^
+%__ToolsetDir%\sdpublic\sdk\inc;^
+%__ToolsetDir%\sdpublic\shared\inc;^
+%__ToolsetDir%\sdpublic\shared\inc\minwin;^
+%__ToolsetDir%\sdpublic\sdk\inc\ucrt;^
+%__ToolsetDir%\sdpublic\sdk\inc\minwin;^
+%__ToolsetDir%\sdpublic\sdk\inc\mincore;^
+%__ToolsetDir%\sdpublic\sdk\inc\abi;^
+%__ToolsetDir%\sdpublic\sdk\inc\clientcore;^
+%__ToolsetDir%\diasdk\include
 exit /b 0