@@ -201,6 +201,8 @@ param
201
201
[string []] $Test = @ (),
202
202
203
203
[switch ] $IncludeDS2 = $false ,
204
+ [ValidateSet (" none" , " full" , " thin" )]
205
+ [string ] $LTO = " none" ,
204
206
[switch ] $IncludeNoAsserts = $false ,
205
207
[ValidateSet (" debug" , " release" )]
206
208
[string ] $FoundationTestConfiguration = " debug" ,
@@ -2055,6 +2057,10 @@ function Get-CompilersDefines([Hashtable] $Platform, [string] $Variant, [switch]
2055
2057
$SwiftFlags += @ (" -Xcc" , " -D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH" );
2056
2058
}
2057
2059
2060
+ if ($LTO -ne " none" ) {
2061
+ $SwiftFlags += @ (" -use-ld=lld" );
2062
+ }
2063
+
2058
2064
return $TestDefines + $DebugDefines + @ {
2059
2065
CLANG_TABLEGEN = (Join-Path - Path $BuildTools - ChildPath " clang-tblgen.exe" );
2060
2066
CLANG_TIDY_CONFUSABLE_CHARS_GEN = (Join-Path - Path $BuildTools - ChildPath " clang-tidy-confusable-chars-gen.exe" );
@@ -2068,6 +2074,17 @@ function Get-CompilersDefines([Hashtable] $Platform, [string] $Variant, [switch]
2068
2074
LLDB_TEST_MAKE = " $BinaryCache \GnuWin32Make-4.4.1\bin\make.exe" ;
2069
2075
LLVM_CONFIG_PATH = (Join-Path - Path $BuildTools - ChildPath " llvm-config.exe" );
2070
2076
LLVM_ENABLE_ASSERTIONS = $ (if ($Variant -eq " Asserts" ) { " YES" } else { " NO" })
2077
+ LLVM_ENABLE_LTO = $ (switch ($LTO ) {
2078
+ " none" { " OFF" }
2079
+ default {
2080
+ if ($UseHostToolchain ) { throw " LTO is not supported with the host toolchain" }
2081
+ " $LTO "
2082
+ }
2083
+ })
2084
+ LLVM_ENABLE_LLD = $ (switch ($LTO ) {
2085
+ " none" { " NO" }
2086
+ default { " YES" }
2087
+ })
2071
2088
LLVM_EXTERNAL_SWIFT_SOURCE_DIR = " $SourceCache \swift" ;
2072
2089
LLVM_HOST_TRIPLE = $Platform.Triple ;
2073
2090
LLVM_NATIVE_TOOL_DIR = $BuildTools ;
0 commit comments