@@ -423,6 +423,8 @@ enum TargetComponent {
423
423
Foundation
424
424
XCTest
425
425
Testing
426
+ ClangBuiltins
427
+ ClangRuntime
426
428
}
427
429
428
430
function Get-TargetProjectBinaryCache ($Arch , [TargetComponent ]$Project ) {
@@ -1690,13 +1692,61 @@ function Build-LLVM([Platform]$Platform, $Arch) {
1690
1692
- Bin (Get-TargetProjectBinaryCache $Arch LLVM) `
1691
1693
- Arch $Arch `
1692
1694
- Platform $Platform `
1693
- - UseMSVCCompilers C, CXX `
1695
+ - UseBuiltCompilers C, CXX `
1694
1696
- Defines @ {
1695
1697
CMAKE_SYSTEM_NAME = $Platform.ToString ();
1696
1698
LLVM_HOST_TRIPLE = $Arch.LLVMTarget ;
1697
1699
}
1698
1700
}
1699
1701
1702
+ function Build-Sanitizers ([Platform ]$Platform , $Arch ) {
1703
+ $LLVMTargetCache = $ (Get-TargetProjectBinaryCache $Arch LLVM)
1704
+ $LITVersionStr = $ (Invoke-Program $ (Get-PythonExecutable ) " $LLVMTargetCache \bin\llvm-lit.py" -- version)
1705
+ if (-not ($LITVersionStr -match " lit (\d+)\.\d+\.\d+.*" )) {
1706
+ throw " Unexpected version string output from llvm-lit.py"
1707
+ }
1708
+ $LLVMVersionMajor = $Matches.1
1709
+ $InstallTo = " $ ( $HostArch.ToolchainInstallRoot ) \usr\lib\clang\$LLVMVersionMajor "
1710
+ Write-Host " Sanitizers SDK directory: $InstallTo "
1711
+
1712
+ Build-CMakeProject `
1713
+ - Src $SourceCache \llvm- project\compiler- rt\lib\builtins `
1714
+ - Bin " $ ( Get-TargetProjectBinaryCache $Arch ClangBuiltins) " `
1715
+ - InstallTo $InstallTo `
1716
+ - Arch $Arch `
1717
+ - Platform $Platform `
1718
+ - UseBuiltCompilers ASM, C, CXX `
1719
+ - BuildTargets " install-compiler-rt" `
1720
+ - Defines (@ {
1721
+ CMAKE_SYSTEM_NAME = $Platform.ToString ();
1722
+ LLVM_DIR = " $LLVMTargetCache \lib\cmake\llvm" ;
1723
+ LLVM_ENABLE_PER_TARGET_RUNTIME_DIR = " YES" ;
1724
+ COMPILER_RT_DEFAULT_TARGET_ONLY = " YES" ;
1725
+ })
1726
+
1727
+ Build-CMakeProject `
1728
+ - Src $SourceCache \llvm- project\compiler- rt `
1729
+ - Bin " $ ( Get-TargetProjectBinaryCache $Arch ClangRuntime) " `
1730
+ - InstallTo $InstallTo `
1731
+ - Arch $Arch `
1732
+ - Platform $Platform `
1733
+ - UseBuiltCompilers ASM, C, CXX `
1734
+ - BuildTargets " install-compiler-rt" `
1735
+ - Defines (@ {
1736
+ CMAKE_SYSTEM_NAME = $Platform.ToString ();
1737
+ LLVM_DIR = " $LLVMTargetCache \lib\cmake\llvm" ;
1738
+ LLVM_ENABLE_PER_TARGET_RUNTIME_DIR = " YES" ;
1739
+ COMPILER_RT_DEFAULT_TARGET_ONLY = " YES" ;
1740
+ COMPILER_RT_BUILD_BUILTINS = " NO" ;
1741
+ COMPILER_RT_BUILD_CRT = " NO" ;
1742
+ COMPILER_RT_BUILD_LIBFUZZER = " NO" ;
1743
+ COMPILER_RT_BUILD_ORC = " NO" ;
1744
+ COMPILER_RT_BUILD_XRAY = " NO" ;
1745
+ COMPILER_RT_BUILD_PROFILE = " YES" ;
1746
+ COMPILER_RT_BUILD_SANITIZERS = " YES" ;
1747
+ })
1748
+ }
1749
+
1700
1750
function Build-ZLib ([Platform ]$Platform , $Arch ) {
1701
1751
$ArchName = $Arch.LLVMName
1702
1752
@@ -2919,6 +2969,7 @@ if (-not $SkipBuild) {
2919
2969
Invoke-BuildStep Build-FoundationMacros - Build Windows $BuildArch
2920
2970
Invoke-BuildStep Build-TestingMacros - Build Windows $BuildArch
2921
2971
Invoke-BuildStep Build-Foundation Windows $Arch
2972
+ Invoke-BuildStep Build-Sanitizers Windows $Arch
2922
2973
Invoke-BuildStep Build-XCTest Windows $Arch
2923
2974
Invoke-BuildStep Build-Testing Windows $Arch
2924
2975
Invoke-BuildStep Write-SDKSettingsPlist Windows $Arch
@@ -2938,6 +2989,7 @@ if (-not $SkipBuild) {
2938
2989
Invoke-BuildStep Build-Runtime Android $Arch
2939
2990
Invoke-BuildStep Build-Dispatch Android $Arch
2940
2991
Invoke-BuildStep Build-Foundation Android $Arch
2992
+ Invoke-BuildStep Build-Sanitizers Android $Arch
2941
2993
Invoke-BuildStep Build-XCTest Android $Arch
2942
2994
Invoke-BuildStep Build-Testing Android $Arch
2943
2995
Invoke-BuildStep Write-SDKSettingsPlist Android $Arch
0 commit comments