diff options
author | Rahul Kumar <rahku@microsoft.com> | 2016-04-19 14:22:23 -0700 |
---|---|---|
committer | Rahul Kumar <rahku@microsoft.com> | 2016-04-26 10:12:06 -0700 |
commit | 27fc507393a641542a939168b41585895b6b4fc2 (patch) | |
tree | 4e979ea708fe9af0987087a155cf27135e049e97 | |
parent | 5fe61b36cc72d43263fc892c754bb9f46acb5ef5 (diff) | |
download | coreclr-27fc507393a641542a939168b41585895b6b4fc2.tar.gz coreclr-27fc507393a641542a939168b41585895b6b4fc2.tar.bz2 coreclr-27fc507393a641542a939168b41585895b6b4fc2.zip |
This has following changes:
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.
-rw-r--r-- | CMakeLists.txt | 37 | ||||
-rw-r--r-- | build.cmd | 19 | ||||
-rw-r--r-- | compileoptions.cmake | 25 | ||||
-rwxr-xr-x | netci.groovy | 4 | ||||
-rw-r--r-- | src/ToolBox/SOS/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/ToolBox/SOS/Strike/CMakeLists.txt | 9 | ||||
-rw-r--r-- | src/classlibnative/bcltype/decimal.cpp | 4 | ||||
-rw-r--r-- | src/dlls/dbgshim/CMakeLists.txt | 9 | ||||
-rw-r--r-- | src/dlls/mscordac/CMakeLists.txt | 9 | ||||
-rw-r--r-- | src/dlls/mscordbi/CMakeLists.txt | 8 | ||||
-rw-r--r-- | src/inc/tls.h | 16 | ||||
-rw-r--r-- | src/tools/GenClrDebugResource/CMakeLists.txt | 6 | ||||
-rw-r--r-- | src/tools/InjectResource/CMakeLists.txt | 8 | ||||
-rw-r--r-- | src/vm/arm64/crthelpers.asm | 2 | ||||
-rw-r--r-- | tests/buildtest.cmd | 19 |
15 files changed, 76 insertions, 101 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 17103269da..f1057178ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 @@ -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 diff --git a/compileoptions.cmake b/compileoptions.cmake index 4ec51d3ad2..739b1a214c 100644 --- a/compileoptions.cmake +++ b/compileoptions.cmake @@ -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) diff --git a/netci.groovy b/netci.groovy index bb06d6b47b..f8f5b9714d 100755 --- a/netci.groovy +++ b/netci.groovy @@ -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') diff --git a/src/ToolBox/SOS/CMakeLists.txt b/src/ToolBox/SOS/CMakeLists.txt index f48f3a70c1..9380dc1de6 100644 --- a/src/ToolBox/SOS/CMakeLists.txt +++ b/src/ToolBox/SOS/CMakeLists.txt @@ -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) diff --git a/src/ToolBox/SOS/Strike/CMakeLists.txt b/src/ToolBox/SOS/Strike/CMakeLists.txt index 124fe979b3..36893b1e42 100644 --- a/src/ToolBox/SOS/Strike/CMakeLists.txt +++ b/src/ToolBox/SOS/Strike/CMakeLists.txt @@ -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) diff --git a/src/classlibnative/bcltype/decimal.cpp b/src/classlibnative/bcltype/decimal.cpp index 85743dc3d0..ed63391e54 100644 --- a/src/classlibnative/bcltype/decimal.cpp +++ b/src/classlibnative/bcltype/decimal.cpp @@ -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; } diff --git a/src/dlls/dbgshim/CMakeLists.txt b/src/dlls/dbgshim/CMakeLists.txt index c3ebaf5d06..5024642ca5 100644 --- a/src/dlls/dbgshim/CMakeLists.txt +++ b/src/dlls/dbgshim/CMakeLists.txt @@ -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 diff --git a/src/dlls/mscordac/CMakeLists.txt b/src/dlls/mscordac/CMakeLists.txt index 4a80ef46e7..8c2cec1b81 100644 --- a/src/dlls/mscordac/CMakeLists.txt +++ b/src/dlls/mscordac/CMakeLists.txt @@ -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 diff --git a/src/dlls/mscordbi/CMakeLists.txt b/src/dlls/mscordbi/CMakeLists.txt index b8dfa71ca6..28b006b58c 100644 --- a/src/dlls/mscordbi/CMakeLists.txt +++ b/src/dlls/mscordbi/CMakeLists.txt @@ -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) diff --git a/src/inc/tls.h b/src/inc/tls.h index 05e50575f4..55f74892bb 100644 --- a/src/inc/tls.h +++ b/src/inc/tls.h @@ -15,13 +15,19 @@ #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 diff --git a/src/tools/GenClrDebugResource/CMakeLists.txt b/src/tools/GenClrDebugResource/CMakeLists.txt index c30f391440..ad2598a373 100644 --- a/src/tools/GenClrDebugResource/CMakeLists.txt +++ b/src/tools/GenClrDebugResource/CMakeLists.txt @@ -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 diff --git a/src/tools/InjectResource/CMakeLists.txt b/src/tools/InjectResource/CMakeLists.txt index f8593069ab..a4fd538662 100644 --- a/src/tools/InjectResource/CMakeLists.txt +++ b/src/tools/InjectResource/CMakeLists.txt @@ -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 diff --git a/src/vm/arm64/crthelpers.asm b/src/vm/arm64/crthelpers.asm index 127b3e40fb..a341dc4027 100644 --- a/src/vm/arm64/crthelpers.asm +++ b/src/vm/arm64/crthelpers.asm @@ -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 diff --git a/tests/buildtest.cmd b/tests/buildtest.cmd index 8f23e829d8..1478181946 100644 --- a/tests/buildtest.cmd +++ b/tests/buildtest.cmd @@ -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 |