-
Notifications
You must be signed in to change notification settings - Fork 10.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[windows][toolchain] Build sanitizers and builtins standalone for all SDKs #78861
Changes from all commits
3625597
fe50fea
ee702d9
9f57c93
9c61e36
86f4bcf
7ec4021
98f85d7
e2f501f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
// XFAIL: OS=windows-msvc | ||
// REQUIRES: asan_runtime | ||
|
||
// Default instrumentation that does not use ODR indicators | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -422,6 +422,8 @@ enum TargetComponent { | |
Foundation | ||
XCTest | ||
Testing | ||
ClangBuiltins | ||
ClangRuntime | ||
} | ||
|
||
function Get-TargetProjectBinaryCache($Arch, [TargetComponent]$Project) { | ||
|
@@ -1599,13 +1601,61 @@ function Build-LLVM([Platform]$Platform, $Arch) { | |
-Bin (Get-TargetProjectBinaryCache $Arch LLVM) ` | ||
-Arch $Arch ` | ||
-Platform $Platform ` | ||
-UseMSVCCompilers C,CXX ` | ||
-UseBuiltCompilers C,CXX ` | ||
-Defines @{ | ||
CMAKE_SYSTEM_NAME = $Platform.ToString(); | ||
LLVM_HOST_TRIPLE = $Arch.LLVMTarget; | ||
} | ||
} | ||
|
||
function Build-Sanitizers([Platform]$Platform, $Arch) { | ||
$LLVMTargetCache = $(Get-TargetProjectBinaryCache $Arch LLVM) | ||
$LITVersionStr = $(Invoke-Program $(Get-PythonExecutable) "$LLVMTargetCache\bin\llvm-lit.py" --version) | ||
if (-not ($LITVersionStr -match "lit (\d+)\.\d+\.\d+.*")) { | ||
throw "Unexpected version string output from llvm-lit.py" | ||
} | ||
$LLVMVersionMajor = $Matches.1 | ||
$InstallTo = "$($HostArch.ToolchainInstallRoot)\usr\lib\clang\$LLVMVersionMajor" | ||
Write-Host "Sanitizers SDK directory: $InstallTo" | ||
|
||
Build-CMakeProject ` | ||
-Src $SourceCache\llvm-project\compiler-rt\lib\builtins ` | ||
-Bin "$(Get-TargetProjectBinaryCache $Arch ClangBuiltins)" ` | ||
-InstallTo $InstallTo ` | ||
-Arch $Arch ` | ||
-Platform $Platform ` | ||
-UseBuiltCompilers ASM,C,CXX ` | ||
-BuildTargets "install-compiler-rt" ` | ||
-Defines (@{ | ||
CMAKE_SYSTEM_NAME = $Platform.ToString(); | ||
LLVM_DIR = "$LLVMTargetCache\lib\cmake\llvm"; | ||
LLVM_ENABLE_PER_TARGET_RUNTIME_DIR = "YES"; | ||
COMPILER_RT_DEFAULT_TARGET_ONLY = "YES"; | ||
}) | ||
|
||
Build-CMakeProject ` | ||
-Src $SourceCache\llvm-project\compiler-rt ` | ||
-Bin "$(Get-TargetProjectBinaryCache $Arch ClangRuntime)" ` | ||
-InstallTo $InstallTo ` | ||
-Arch $Arch ` | ||
-Platform $Platform ` | ||
-UseBuiltCompilers ASM,C,CXX ` | ||
-BuildTargets "install-compiler-rt" ` | ||
-Defines (@{ | ||
CMAKE_SYSTEM_NAME = $Platform.ToString(); | ||
LLVM_DIR = "$LLVMTargetCache\lib\cmake\llvm"; | ||
LLVM_ENABLE_PER_TARGET_RUNTIME_DIR = "YES"; | ||
COMPILER_RT_DEFAULT_TARGET_ONLY = "YES"; | ||
COMPILER_RT_BUILD_BUILTINS = "NO"; | ||
COMPILER_RT_BUILD_CRT = "NO"; | ||
COMPILER_RT_BUILD_LIBFUZZER = "NO"; | ||
COMPILER_RT_BUILD_ORC = "NO"; | ||
COMPILER_RT_BUILD_XRAY = "NO"; | ||
COMPILER_RT_BUILD_PROFILE = "YES"; | ||
COMPILER_RT_BUILD_SANITIZERS = "YES"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I could put this into a CMake cache file, but it won't get much simpler There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I can see why it would not simplify much, but, it does make it more obvious that this is static configuration and not logic when you need a last second change to the build. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OTOH the structure in https://github.com/swiftlang/swift/tree/main/cmake/caches forces us to add 7 new files. And they all have identical content. (Unless we outsource CMAKE_SYSTEM_NAME, but it won't make that much of a difference.) I guess it should be: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could look like this for the two arches I am testing right now: weliveindetail@windows-toolchain-sanitizers-standalone-with-caches Not sure. Or should I break the scheme and make just one? |
||
}) | ||
} | ||
|
||
function Build-ZLib([Platform]$Platform, $Arch) { | ||
$ArchName = $Arch.LLVMName | ||
|
||
|
@@ -2822,6 +2872,7 @@ if (-not $SkipBuild) { | |
Invoke-BuildStep Build-FoundationMacros -Build Windows $BuildArch | ||
Invoke-BuildStep Build-TestingMacros -Build Windows $BuildArch | ||
Invoke-BuildStep Build-Foundation Windows $Arch | ||
Invoke-BuildStep Build-Sanitizers Windows $Arch | ||
Invoke-BuildStep Build-XCTest Windows $Arch | ||
Invoke-BuildStep Build-Testing Windows $Arch | ||
Invoke-BuildStep Write-PlatformInfoPlist $Arch | ||
|
@@ -2840,6 +2891,7 @@ if (-not $SkipBuild) { | |
Invoke-BuildStep Build-Runtime Android $Arch | ||
Invoke-BuildStep Build-Dispatch Android $Arch | ||
Invoke-BuildStep Build-Foundation Android $Arch | ||
Invoke-BuildStep Build-Sanitizers Android $Arch | ||
Invoke-BuildStep Build-XCTest Android $Arch | ||
Invoke-BuildStep Build-Testing Android $Arch | ||
Invoke-BuildStep Write-PlatformInfoPlist $Arch | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not strictly related, but I think it's fine to land with this PR.