@@ -723,15 +723,18 @@ public final class LdLinkerSpec : GenericLinkerSpec, SpecIdentifierType, @unchec
723
723
}
724
724
}
725
725
726
- let environment : EnvironmentBindings = self . environmentFromSpec ( cbc, delegate)
727
-
726
+ var environment : [ ( String , String ) ] = self . environmentFromSpec ( cbc, delegate)
727
+ // On Windows, some linker drivers require TMPDIR to be set.
728
+ if cbc. producer. hostOperatingSystem == . windows {
729
+ environment. append ( ( " TMPDIR " , cbc. scope. evaluate ( BuiltinMacros . OBJROOT) . str) )
730
+ }
728
731
// Compute the inputs and outputs.
729
732
var inputs : [ any PlannedNode ] = inputPaths. map { delegate. createNode ( $0) }
730
733
731
734
await inputs. append ( contentsOf: additionalInputDependencies ( cbc, delegate, optionContext: discoveredCommandLineToolSpecInfo ( cbc. producer, cbc. scope, delegate) , lookup: lookup) . map ( delegate. createNode) )
732
735
733
736
// Add dependencies for any arguments indicating a file path.
734
- Self . addAdditionalDependenciesFromCommandLine ( cbc, commandLine, environment, & inputs, & outputs, delegate)
737
+ Self . addAdditionalDependenciesFromCommandLine ( cbc, commandLine, EnvironmentBindings ( environment) , & inputs, & outputs, delegate)
735
738
736
739
let architecture = cbc. scope. evaluate ( BuiltinMacros . arch)
737
740
let buildVariant = cbc. scope. evaluate ( BuiltinMacros . variant)
@@ -777,7 +780,7 @@ public final class LdLinkerSpec : GenericLinkerSpec, SpecIdentifierType, @unchec
777
780
let otherInputs = delegate. buildDirectories. sorted ( ) . compactMap { path in ldSearchPaths. contains ( path. str) ? delegate. createBuildDirectoryNode ( absolutePath: path) : nil } + cbc. commandOrderingInputs
778
781
779
782
// Create the task.
780
- delegate. createTask ( type: self , dependencyData: dependencyInfo, payload: payload, ruleInfo: defaultRuleInfo ( cbc, delegate) , commandLine: commandLine, environment: environment, workingDirectory: cbc. producer. defaultWorkingDirectory, inputs: inputs + otherInputs, outputs: outputs, action: delegate. taskActionCreationDelegate. createDeferredExecutionTaskActionIfRequested ( userPreferences: cbc. producer. userPreferences) , execDescription: resolveExecutionDescription ( cbc, delegate) , enableSandboxing: enableSandboxing)
783
+ delegate. createTask ( type: self , dependencyData: dependencyInfo, payload: payload, ruleInfo: defaultRuleInfo ( cbc, delegate) , commandLine: commandLine, environment: EnvironmentBindings ( environment) , workingDirectory: cbc. producer. defaultWorkingDirectory, inputs: inputs + otherInputs, outputs: outputs, action: delegate. taskActionCreationDelegate. createDeferredExecutionTaskActionIfRequested ( userPreferences: cbc. producer. userPreferences) , execDescription: resolveExecutionDescription ( cbc, delegate) , enableSandboxing: enableSandboxing)
781
784
}
782
785
783
786
public static func addAdditionalDependenciesFromCommandLine( _ cbc: CommandBuildContext , _ commandLine: [ String ] , _ environment: EnvironmentBindings , _ inputs: inout [ any PlannedNode ] , _ outputs: inout [ any PlannedNode ] , _ delegate: any TaskGenerationDelegate ) {
0 commit comments