From 1857d1c2af5de066dcb975c5b6705bc12c185984 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Gr=C3=A4nitz?= Date: Thu, 21 Nov 2024 14:29:27 +0100 Subject: [PATCH 01/11] Initial patch for early feedback --- cmake/caches/Windows-x86_64.cmake | 6 ++++-- utils/build.ps1 | 23 +++++++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/cmake/caches/Windows-x86_64.cmake b/cmake/caches/Windows-x86_64.cmake index 0f146d3f4e43a..10ebe818e17e2 100644 --- a/cmake/caches/Windows-x86_64.cmake +++ b/cmake/caches/Windows-x86_64.cmake @@ -40,7 +40,7 @@ endif() # The builtin targets are used to build the compiler-rt builtins. set(LLVM_BUILTIN_TARGETS ${DEFAULT_BUILTIN_TARGETS} CACHE STRING "") -# The runtime targets are used to build the compiler-rt profile library. +# The runtime targets are used to build the profile and sanitizer libs from compiler-rt. set(LLVM_RUNTIME_TARGETS x86_64-unknown-windows-msvc aarch64-unknown-windows-msvc @@ -58,8 +58,10 @@ foreach(target ${LLVM_RUNTIME_TARGETS}) set(RUNTIMES_${target}_COMPILER_RT_BUILD_LIBFUZZER NO CACHE BOOL "") set(RUNTIMES_${target}_COMPILER_RT_BUILD_ORC NO CACHE BOOL "") set(RUNTIMES_${target}_COMPILER_RT_BUILD_PROFILE YES CACHE BOOL "") - set(RUNTIMES_${target}_COMPILER_RT_BUILD_SANITIZERS NO CACHE BOOL "") set(RUNTIMES_${target}_COMPILER_RT_BUILD_XRAY NO CACHE BOOL "") + # Sanitizers will be configured, but not built. We have separate build + # steps for that, because we need a different shell for each target. + set(RUNTIMES_${target}_COMPILER_RT_BUILD_SANITIZERS NO CACHE BOOL "") endforeach() foreach(target ${LLVM_BUILTIN_TARGETS}) diff --git a/utils/build.ps1 b/utils/build.ps1 index cb800f768d3c4..7c595e22e36d8 100644 --- a/utils/build.ps1 +++ b/utils/build.ps1 @@ -66,6 +66,9 @@ If no such Windows SDK is installed, it will be downloaded from nuget. Include the ds2 remote debug server in the SDK. This component is currently only supported in Android builds. +.PARAMETER IncludeSanitizers +If set, include ASAN and UBSAN artifacts in the toolchain. + .PARAMETER SkipBuild If set, does not run the build phase. @@ -1764,6 +1767,21 @@ function Build-CURL([Platform]$Platform, $Arch) { }) } +function Build-Sanitizers([Platform]$Platform, $Arch, $InstallTo) { + Isolate-EnvVars { + # Use configured compilers + Build-CMakeProject ` + -Src $SourceCache\llvm-project\runtimes ` + -Bin "$(Get-HostProjectBinaryCache Compilers)\runtimes\runtimes-$($Arch.LLVMTarget)-bins" ` + -InstallTo $InstallTo ` + -Arch $Arch ` + -Platform $Platform ` + -Defines (@{ + COMPILER_RT_BUILD_SANITIZERS = "YES" + }) + } +} + function Build-Runtime([Platform]$Platform, $Arch) { $PlatformDefines = @{} if ($Platform -eq "Android") { @@ -2756,6 +2774,11 @@ if (-not $SkipBuild) { Invoke-BuildStep Build-CMark $HostArch Invoke-BuildStep Build-Compilers $HostArch + if ($IncludeSanitizers) { + $InstallTo = "$($HostArch.ToolchainInstallRoot)\usr" + Invoke-BuildStep Build-Sanitizers Windows $ArchX64 $InstallTo + Invoke-BuildStep Build-Sanitizers Windows $ArchARM64 $InstallTo + } } if ($Clean) { From c7da7185aba40fd056815d9576b645e52db877fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Gr=C3=A4nitz?= Date: Thu, 21 Nov 2024 15:18:18 +0100 Subject: [PATCH 02/11] Enable builtins for all runtime targets in CMake cache file --- cmake/caches/Windows-x86_64.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/caches/Windows-x86_64.cmake b/cmake/caches/Windows-x86_64.cmake index 10ebe818e17e2..c74136936065b 100644 --- a/cmake/caches/Windows-x86_64.cmake +++ b/cmake/caches/Windows-x86_64.cmake @@ -53,7 +53,7 @@ foreach(target ${LLVM_RUNTIME_TARGETS}) set(RUNTIMES_${target}_CMAKE_MT mt CACHE STRING "") set(RUNTIMES_${target}_CMAKE_SYSTEM_NAME Windows CACHE STRING "") set(RUNTIMES_${target}_CMAKE_BUILD_TYPE Release CACHE STRING "") - set(RUNTIMES_${target}_COMPILER_RT_BUILD_BUILTINS NO CACHE BOOL "") + set(RUNTIMES_${target}_COMPILER_RT_BUILD_BUILTINS YES CACHE BOOL "") set(RUNTIMES_${target}_COMPILER_RT_BUILD_CRT NO CACHE BOOL "") set(RUNTIMES_${target}_COMPILER_RT_BUILD_LIBFUZZER NO CACHE BOOL "") set(RUNTIMES_${target}_COMPILER_RT_BUILD_ORC NO CACHE BOOL "") From 9b024399fce8b1816f8be98f4998922ea2b560a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Gr=C3=A4nitz?= Date: Thu, 21 Nov 2024 15:56:51 +0100 Subject: [PATCH 03/11] Add missing default for IncludeSanitizers option --- utils/build.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/utils/build.ps1 b/utils/build.ps1 index 7c595e22e36d8..2c7d8e3039f80 100644 --- a/utils/build.ps1 +++ b/utils/build.ps1 @@ -138,6 +138,7 @@ param( [switch] $SkipRedistInstall = $false, [switch] $SkipPackaging = $false, [switch] $IncludeDS2 = $false, + [switch] $IncludeSanitizers = $false, [string[]] $Test = @(), [string] $Stage = "", [string] $BuildTo = "", From 76be94975007d63a29c7e15a81f4fcc4bdad3565 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Gr=C3=A4nitz?= Date: Tue, 26 Nov 2024 16:01:48 +0100 Subject: [PATCH 04/11] Align default targets for builtins and runtimes on x86_64 hosts --- cmake/caches/Windows-x86_64.cmake | 25 +++++++++++++------------ utils/build.ps1 | 8 ++++++-- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/cmake/caches/Windows-x86_64.cmake b/cmake/caches/Windows-x86_64.cmake index c74136936065b..3eab1b9bd56ca 100644 --- a/cmake/caches/Windows-x86_64.cmake +++ b/cmake/caches/Windows-x86_64.cmake @@ -27,24 +27,21 @@ set(LLVM_APPEND_VC_REV NO CACHE BOOL "") set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR YES CACHE BOOL "") set(LLVM_ENABLE_PYTHON YES CACHE BOOL "") -set(DEFAULT_BUILTIN_TARGETS +set(default_targets x86_64-unknown-windows-msvc - aarch64-unknown-windows-msvc) + aarch64-unknown-windows-msvc + i686-unknown-windows-msvc) # Build the android builtins if NDK path is provided. if(NOT "$ENV{NDKPATH}" STREQUAL "") - list(APPEND DEFAULT_BUILTIN_TARGETS + list(APPEND default_targets aarch64-unknown-linux-android - x86_64-unknown-linux-android) + x86_64-unknown-linux-android + i686-unknown-linux-android + armv7-unknown-linux-androideabi) endif() -# The builtin targets are used to build the compiler-rt builtins. -set(LLVM_BUILTIN_TARGETS ${DEFAULT_BUILTIN_TARGETS} CACHE STRING "") - -# The runtime targets are used to build the profile and sanitizer libs from compiler-rt. -set(LLVM_RUNTIME_TARGETS - x86_64-unknown-windows-msvc - aarch64-unknown-windows-msvc - CACHE STRING "") +set(LLVM_BUILTIN_TARGETS ${default_targets} CACHE STRING "") +set(LLVM_RUNTIME_TARGETS ${default_targets} CACHE STRING "") foreach(target ${LLVM_RUNTIME_TARGETS}) set(RUNTIMES_${target}_LLVM_ENABLE_RUNTIMES @@ -74,6 +71,10 @@ foreach(target ${LLVM_BUILTIN_TARGETS}) set(BUILTINS_${target}_CMAKE_SYSTEM_NAME Android CACHE STRING "") if(${target} MATCHES aarch64) set(BUILTINS_${target}_CMAKE_ANDROID_ARCH_ABI arm64-v8a CACHE STRING "") + elseif(${target} MATCHES armv7) + set(BUILTINS_${target}_CMAKE_ANDROID_ARCH_ABI armeabi-v7a CACHE STRING "") + elseif(${target} MATCHES i686) + set(BUILTINS_${target}_CMAKE_ANDROID_ARCH_ABI i686 CACHE STRING "") else() set(BUILTINS_${target}_CMAKE_ANDROID_ARCH_ABI x86_64 CACHE STRING "") endif() diff --git a/utils/build.ps1 b/utils/build.ps1 index 2c7d8e3039f80..af0a005914876 100644 --- a/utils/build.ps1 +++ b/utils/build.ps1 @@ -2777,8 +2777,12 @@ if (-not $SkipBuild) { Invoke-BuildStep Build-Compilers $HostArch if ($IncludeSanitizers) { $InstallTo = "$($HostArch.ToolchainInstallRoot)\usr" - Invoke-BuildStep Build-Sanitizers Windows $ArchX64 $InstallTo - Invoke-BuildStep Build-Sanitizers Windows $ArchARM64 $InstallTo + foreach ($Arch in $WindowsSDKArchs) { + Invoke-BuildStep Build-Sanitizers Windows $Arch $InstallTo + } + foreach ($Arch in $AndroidSDKArchs) { + Invoke-BuildStep Build-Sanitizers Windows $Arch $InstallTo + } } } From 4a93d76818a6633a78e616ad86f0ee7053e6201c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Gr=C3=A4nitz?= Date: Tue, 26 Nov 2024 16:12:36 +0100 Subject: [PATCH 05/11] Rename option: IncludeSanitizers -> BuildSanitizers --- utils/build.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/utils/build.ps1 b/utils/build.ps1 index af0a005914876..9b4760b161de1 100644 --- a/utils/build.ps1 +++ b/utils/build.ps1 @@ -66,7 +66,7 @@ If no such Windows SDK is installed, it will be downloaded from nuget. Include the ds2 remote debug server in the SDK. This component is currently only supported in Android builds. -.PARAMETER IncludeSanitizers +.PARAMETER BuildSanitizers If set, include ASAN and UBSAN artifacts in the toolchain. .PARAMETER SkipBuild @@ -138,7 +138,7 @@ param( [switch] $SkipRedistInstall = $false, [switch] $SkipPackaging = $false, [switch] $IncludeDS2 = $false, - [switch] $IncludeSanitizers = $false, + [switch] $BuildSanitizers = $false, [string[]] $Test = @(), [string] $Stage = "", [string] $BuildTo = "", @@ -2775,7 +2775,7 @@ if (-not $SkipBuild) { Invoke-BuildStep Build-CMark $HostArch Invoke-BuildStep Build-Compilers $HostArch - if ($IncludeSanitizers) { + if ($BuildSanitizers) { $InstallTo = "$($HostArch.ToolchainInstallRoot)\usr" foreach ($Arch in $WindowsSDKArchs) { Invoke-BuildStep Build-Sanitizers Windows $Arch $InstallTo From e391a11a2c5bd127b24be4a2da7762c7dcec6943 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Gr=C3=A4nitz?= Date: Wed, 27 Nov 2024 16:17:21 +0100 Subject: [PATCH 06/11] Align settings for builtins and runtimes in CMake cache for aarch64 hosts --- cmake/caches/Windows-aarch64.cmake | 50 ++++++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 3 deletions(-) diff --git a/cmake/caches/Windows-aarch64.cmake b/cmake/caches/Windows-aarch64.cmake index 6dd9a786b9065..5839044b03e81 100644 --- a/cmake/caches/Windows-aarch64.cmake +++ b/cmake/caches/Windows-aarch64.cmake @@ -26,9 +26,23 @@ set(LLVM_DEFAULT_TARGET_TRIPLE aarch64-unknown-windows-msvc CACHE STRING "") set(LLVM_APPEND_VC_REV NO CACHE BOOL "") set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR YES CACHE BOOL "") set(LLVM_ENABLE_PYTHON YES CACHE BOOL "") -set(LLVM_RUNTIME_TARGETS + +set(default_targets + x86_64-unknown-windows-msvc aarch64-unknown-windows-msvc - CACHE STRING "") + i686-unknown-windows-msvc) +# Build the android builtins if NDK path is provided. +if(NOT "$ENV{NDKPATH}" STREQUAL "") + list(APPEND default_targets + aarch64-unknown-linux-android + x86_64-unknown-linux-android + i686-unknown-linux-android + armv7-unknown-linux-androideabi) +endif() + +set(LLVM_BUILTIN_TARGETS ${default_targets} CACHE STRING "") +set(LLVM_RUNTIME_TARGETS ${default_targets} CACHE STRING "") + foreach(target ${LLVM_RUNTIME_TARGETS}) set(RUNTIMES_${target}_LLVM_ENABLE_RUNTIMES compiler-rt @@ -36,11 +50,40 @@ foreach(target ${LLVM_RUNTIME_TARGETS}) set(RUNTIMES_${target}_CMAKE_MT mt CACHE STRING "") set(RUNTIMES_${target}_CMAKE_SYSTEM_NAME Windows CACHE STRING "") set(RUNTIMES_${target}_CMAKE_BUILD_TYPE Release CACHE STRING "") + set(RUNTIMES_${target}_COMPILER_RT_BUILD_BUILTINS YES CACHE BOOL "") set(RUNTIMES_${target}_COMPILER_RT_BUILD_CRT NO CACHE BOOL "") set(RUNTIMES_${target}_COMPILER_RT_BUILD_LIBFUZZER NO CACHE BOOL "") + set(RUNTIMES_${target}_COMPILER_RT_BUILD_ORC NO CACHE BOOL "") set(RUNTIMES_${target}_COMPILER_RT_BUILD_PROFILE YES CACHE BOOL "") + set(RUNTIMES_${target}_COMPILER_RT_BUILD_XRAY NO CACHE BOOL "") + # Sanitizers will be configured, but not built. We have separate build + # steps for that, because we need a different shell for each target. set(RUNTIMES_${target}_COMPILER_RT_BUILD_SANITIZERS NO CACHE BOOL "") - set(RUNTIMES_${target}_COMPILER_RT_BUILD_XRAY NO CACHE BOOL "") +endforeach() + +foreach(target ${LLVM_BUILTIN_TARGETS}) + set(BUILTINS_${target}_CMAKE_MT mt CACHE STRING "") + if(${target} MATCHES windows-msvc) + set(BUILTINS_${target}_CMAKE_SYSTEM_NAME Windows CACHE STRING "") + elseif(${target} MATCHES linux-android) + # Use a single 'linux' directory and arch-based lib names on Android. + set(BUILTINS_${target}_LLVM_ENABLE_PER_TARGET_RUNTIME_DIR NO CACHE BOOL "") + set(BUILTINS_${target}_CMAKE_SYSTEM_NAME Android CACHE STRING "") + if(${target} MATCHES aarch64) + set(BUILTINS_${target}_CMAKE_ANDROID_ARCH_ABI arm64-v8a CACHE STRING "") + elseif(${target} MATCHES armv7) + set(BUILTINS_${target}_CMAKE_ANDROID_ARCH_ABI armeabi-v7a CACHE STRING "") + elseif(${target} MATCHES i686) + set(BUILTINS_${target}_CMAKE_ANDROID_ARCH_ABI i686 CACHE STRING "") + else() + set(BUILTINS_${target}_CMAKE_ANDROID_ARCH_ABI x86_64 CACHE STRING "") + endif() + set(BUILTINS_${target}_CMAKE_ANDROID_NDK $ENV{NDKPATH} CACHE PATH "") + set(BUILTINS_${target}_CMAKE_ANDROID_API 21 CACHE STRING "") + set(BUILTINS_${target}_CMAKE_C_COMPILER_TARGET "${target}21" CACHE STRING "") + set(BUILTINS_${target}_CMAKE_CXX_COMPILER_TARGET "${target}21" CACHE STRING "") + endif() + set(BUILTINS_${target}_CMAKE_BUILD_TYPE Release CACHE STRING "") endforeach() set(LLVM_TARGETS_TO_BUILD AArch64 ARM WebAssembly X86 CACHE STRING "") @@ -165,6 +208,7 @@ set(LLVM_DISTRIBUTION_COMPONENTS libclang libclang-headers LTO + builtins runtimes ${LLVM_TOOLCHAIN_TOOLS} ${CLANG_TOOLS} From 5bd3ed3577cdfc5cb65c9e100f04f5ec6513d0eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Gr=C3=A4nitz?= Date: Thu, 28 Nov 2024 12:48:20 +0100 Subject: [PATCH 07/11] Fix CMAKE_ANDROID_ARCH_ABI=x86 for i686-unknown-linux-android --- cmake/caches/Windows-aarch64.cmake | 2 +- cmake/caches/Windows-x86_64.cmake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/caches/Windows-aarch64.cmake b/cmake/caches/Windows-aarch64.cmake index 5839044b03e81..6c68ecf19f95a 100644 --- a/cmake/caches/Windows-aarch64.cmake +++ b/cmake/caches/Windows-aarch64.cmake @@ -74,7 +74,7 @@ foreach(target ${LLVM_BUILTIN_TARGETS}) elseif(${target} MATCHES armv7) set(BUILTINS_${target}_CMAKE_ANDROID_ARCH_ABI armeabi-v7a CACHE STRING "") elseif(${target} MATCHES i686) - set(BUILTINS_${target}_CMAKE_ANDROID_ARCH_ABI i686 CACHE STRING "") + set(BUILTINS_${target}_CMAKE_ANDROID_ARCH_ABI x86 CACHE STRING "") else() set(BUILTINS_${target}_CMAKE_ANDROID_ARCH_ABI x86_64 CACHE STRING "") endif() diff --git a/cmake/caches/Windows-x86_64.cmake b/cmake/caches/Windows-x86_64.cmake index 3eab1b9bd56ca..ad43b95f6c68d 100644 --- a/cmake/caches/Windows-x86_64.cmake +++ b/cmake/caches/Windows-x86_64.cmake @@ -74,7 +74,7 @@ foreach(target ${LLVM_BUILTIN_TARGETS}) elseif(${target} MATCHES armv7) set(BUILTINS_${target}_CMAKE_ANDROID_ARCH_ABI armeabi-v7a CACHE STRING "") elseif(${target} MATCHES i686) - set(BUILTINS_${target}_CMAKE_ANDROID_ARCH_ABI i686 CACHE STRING "") + set(BUILTINS_${target}_CMAKE_ANDROID_ARCH_ABI x86 CACHE STRING "") else() set(BUILTINS_${target}_CMAKE_ANDROID_ARCH_ABI x86_64 CACHE STRING "") endif() From 934c9e3816d599f3433bbbd94384775ab7c73ea0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Gr=C3=A4nitz?= Date: Thu, 28 Nov 2024 12:49:37 +0100 Subject: [PATCH 08/11] Build sanitizers for all enabled SDKs by default --- utils/build.ps1 | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/utils/build.ps1 b/utils/build.ps1 index 9b4760b161de1..1f69a69f7fa5d 100644 --- a/utils/build.ps1 +++ b/utils/build.ps1 @@ -66,9 +66,6 @@ If no such Windows SDK is installed, it will be downloaded from nuget. Include the ds2 remote debug server in the SDK. This component is currently only supported in Android builds. -.PARAMETER BuildSanitizers -If set, include ASAN and UBSAN artifacts in the toolchain. - .PARAMETER SkipBuild If set, does not run the build phase. @@ -138,7 +135,6 @@ param( [switch] $SkipRedistInstall = $false, [switch] $SkipPackaging = $false, [switch] $IncludeDS2 = $false, - [switch] $BuildSanitizers = $false, [string[]] $Test = @(), [string] $Stage = "", [string] $BuildTo = "", @@ -2775,14 +2771,13 @@ if (-not $SkipBuild) { Invoke-BuildStep Build-CMark $HostArch Invoke-BuildStep Build-Compilers $HostArch - if ($BuildSanitizers) { - $InstallTo = "$($HostArch.ToolchainInstallRoot)\usr" - foreach ($Arch in $WindowsSDKArchs) { - Invoke-BuildStep Build-Sanitizers Windows $Arch $InstallTo - } - foreach ($Arch in $AndroidSDKArchs) { - Invoke-BuildStep Build-Sanitizers Windows $Arch $InstallTo - } + + $InstallTo = "$($HostArch.ToolchainInstallRoot)\usr" + foreach ($Arch in $WindowsSDKArchs) { + Invoke-BuildStep Build-Sanitizers Windows $Arch $InstallTo + } + foreach ($Arch in $AndroidSDKArchs) { + Invoke-BuildStep Build-Sanitizers Windows $Arch $InstallTo } } From cf748a9dd0c7dcf73a02cd4aa85a563f83f64f8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Gr=C3=A4nitz?= Date: Thu, 28 Nov 2024 17:00:00 +0100 Subject: [PATCH 09/11] Exclude Anroid targets for the moment --- cmake/caches/Windows-aarch64.cmake | 3 ++- cmake/caches/Windows-x86_64.cmake | 3 ++- utils/build.ps1 | 3 --- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/cmake/caches/Windows-aarch64.cmake b/cmake/caches/Windows-aarch64.cmake index 6c68ecf19f95a..0205f96e705fc 100644 --- a/cmake/caches/Windows-aarch64.cmake +++ b/cmake/caches/Windows-aarch64.cmake @@ -31,6 +31,8 @@ set(default_targets x86_64-unknown-windows-msvc aarch64-unknown-windows-msvc i686-unknown-windows-msvc) +set(LLVM_RUNTIME_TARGETS ${default_targets} CACHE STRING "") + # Build the android builtins if NDK path is provided. if(NOT "$ENV{NDKPATH}" STREQUAL "") list(APPEND default_targets @@ -41,7 +43,6 @@ if(NOT "$ENV{NDKPATH}" STREQUAL "") endif() set(LLVM_BUILTIN_TARGETS ${default_targets} CACHE STRING "") -set(LLVM_RUNTIME_TARGETS ${default_targets} CACHE STRING "") foreach(target ${LLVM_RUNTIME_TARGETS}) set(RUNTIMES_${target}_LLVM_ENABLE_RUNTIMES diff --git a/cmake/caches/Windows-x86_64.cmake b/cmake/caches/Windows-x86_64.cmake index ad43b95f6c68d..7878887b3f824 100644 --- a/cmake/caches/Windows-x86_64.cmake +++ b/cmake/caches/Windows-x86_64.cmake @@ -31,6 +31,8 @@ set(default_targets x86_64-unknown-windows-msvc aarch64-unknown-windows-msvc i686-unknown-windows-msvc) +set(LLVM_RUNTIME_TARGETS ${default_targets} CACHE STRING "") + # Build the android builtins if NDK path is provided. if(NOT "$ENV{NDKPATH}" STREQUAL "") list(APPEND default_targets @@ -41,7 +43,6 @@ if(NOT "$ENV{NDKPATH}" STREQUAL "") endif() set(LLVM_BUILTIN_TARGETS ${default_targets} CACHE STRING "") -set(LLVM_RUNTIME_TARGETS ${default_targets} CACHE STRING "") foreach(target ${LLVM_RUNTIME_TARGETS}) set(RUNTIMES_${target}_LLVM_ENABLE_RUNTIMES diff --git a/utils/build.ps1 b/utils/build.ps1 index 1f69a69f7fa5d..942c3464e8bc2 100644 --- a/utils/build.ps1 +++ b/utils/build.ps1 @@ -2776,9 +2776,6 @@ if (-not $SkipBuild) { foreach ($Arch in $WindowsSDKArchs) { Invoke-BuildStep Build-Sanitizers Windows $Arch $InstallTo } - foreach ($Arch in $AndroidSDKArchs) { - Invoke-BuildStep Build-Sanitizers Windows $Arch $InstallTo - } } if ($Clean) { From 53d0781937c4b0aa83e4e5ae969b4a438bf6a928 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Gr=C3=A4nitz?= Date: Tue, 3 Dec 2024 17:19:15 +0100 Subject: [PATCH 10/11] fixup! Enable builtins for all runtime targets in CMake cache file --- cmake/caches/Windows-aarch64.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/caches/Windows-aarch64.cmake b/cmake/caches/Windows-aarch64.cmake index 0205f96e705fc..fef9e80fe1672 100644 --- a/cmake/caches/Windows-aarch64.cmake +++ b/cmake/caches/Windows-aarch64.cmake @@ -56,7 +56,7 @@ foreach(target ${LLVM_RUNTIME_TARGETS}) set(RUNTIMES_${target}_COMPILER_RT_BUILD_LIBFUZZER NO CACHE BOOL "") set(RUNTIMES_${target}_COMPILER_RT_BUILD_ORC NO CACHE BOOL "") set(RUNTIMES_${target}_COMPILER_RT_BUILD_PROFILE YES CACHE BOOL "") - set(RUNTIMES_${target}_COMPILER_RT_BUILD_XRAY NO CACHE BOOL "") + set(RUNTIMES_${target}_COMPILER_RT_BUILD_XRAY NO CACHE BOOL "") # Sanitizers will be configured, but not built. We have separate build # steps for that, because we need a different shell for each target. set(RUNTIMES_${target}_COMPILER_RT_BUILD_SANITIZERS NO CACHE BOOL "") From 2f7116a36f6461731309305052a0f0f70a7469c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Gr=C3=A4nitz?= Date: Tue, 3 Dec 2024 18:41:49 +0100 Subject: [PATCH 11/11] Disable tests newly included with asan_runtime available, but not supported on Windows yet --- test/Driver/sanitize_coverage.swift | 2 ++ test/IRGen/address_sanitizer_use_odr_indicator.swift | 1 + test/Interpreter/indirect_enum.swift | 2 ++ test/Reflection/typeref_decoding_asan.swift | 1 + test/Sanitizers/asan/asan.swift | 2 ++ test/Sanitizers/sanitizer_coverage.swift | 1 + 6 files changed, 9 insertions(+) diff --git a/test/Driver/sanitize_coverage.swift b/test/Driver/sanitize_coverage.swift index e41562a7a4c2f..3192f24945169 100644 --- a/test/Driver/sanitize_coverage.swift +++ b/test/Driver/sanitize_coverage.swift @@ -1,3 +1,5 @@ +// UNSUPPORTED: OS=windows-msvc + // Different sanitizer coverage types // RUN: %swiftc_driver -driver-print-jobs -sanitize-coverage=func -sanitize=address %s | %FileCheck -check-prefix=SANCOV_FUNC %s // RUN: %swiftc_driver -driver-print-jobs -sanitize-coverage=bb -sanitize=address %s | %FileCheck -check-prefix=SANCOV_BB %s diff --git a/test/IRGen/address_sanitizer_use_odr_indicator.swift b/test/IRGen/address_sanitizer_use_odr_indicator.swift index 1ed723e25c08e..a529a4067cbfa 100644 --- a/test/IRGen/address_sanitizer_use_odr_indicator.swift +++ b/test/IRGen/address_sanitizer_use_odr_indicator.swift @@ -1,3 +1,4 @@ +// UNSUPPORTED: OS=windows-msvc // REQUIRES: asan_runtime // Default instrumentation that does not use ODR indicators diff --git a/test/Interpreter/indirect_enum.swift b/test/Interpreter/indirect_enum.swift index 3f5359ed360a7..fdc54ed5ff400 100644 --- a/test/Interpreter/indirect_enum.swift +++ b/test/Interpreter/indirect_enum.swift @@ -1,3 +1,5 @@ +// UNSUPPORTED: OS=windows-msvc + // RUN: %target-swiftc_driver %s -g -sanitize=address -o %t_asan-binary // RUN: %target-codesign %t_asan-binary // RUN: env ASAN_OPTIONS=detect_leaks=0 %target-run %t_asan-binary diff --git a/test/Reflection/typeref_decoding_asan.swift b/test/Reflection/typeref_decoding_asan.swift index 2bd6be187db44..8ddc7ae2c1489 100644 --- a/test/Reflection/typeref_decoding_asan.swift +++ b/test/Reflection/typeref_decoding_asan.swift @@ -1,4 +1,5 @@ // UNSUPPORTED: OS=linux-gnu && CPU=aarch64 +// UNSUPPORTED: OS=windows-msvc // rdar://100805115 // UNSUPPORTED: CPU=arm64e diff --git a/test/Sanitizers/asan/asan.swift b/test/Sanitizers/asan/asan.swift index 3b2005523a009..b929582346856 100644 --- a/test/Sanitizers/asan/asan.swift +++ b/test/Sanitizers/asan/asan.swift @@ -1,3 +1,5 @@ +// UNSUPPORTED: OS=windows-msvc + // RUN: %target-swiftc_driver %s -g -sanitize=address -o %t_asan-binary // RUN: %target-codesign %t_asan-binary // RUN: env %env-ASAN_OPTIONS=abort_on_error=0 not %target-run %t_asan-binary 2>&1 | %FileCheck %s diff --git a/test/Sanitizers/sanitizer_coverage.swift b/test/Sanitizers/sanitizer_coverage.swift index 8044beeb37033..a945d63994c70 100644 --- a/test/Sanitizers/sanitizer_coverage.swift +++ b/test/Sanitizers/sanitizer_coverage.swift @@ -9,6 +9,7 @@ // For now restrict this test to platforms where we know this test will pass // REQUIRES: CPU=x86_64 // UNSUPPORTED: remote_run +// UNSUPPORTED: OS=windows-msvc func sayHello() { print("Hello")