Open
Description
Description
Using -enable-batch-mode results in a link failure as wrong object file name is used.
Reproduction
$ swiftc -enable-batch-mode ~/hw.swift
error: link command failed with exit code 1 (use -v to see invocation)
clang: error: no such file or directory: '/var/folders/cl/z48nl9xx18307rwb9l42n2yr0000gn/T/TemporaryDirectory.u1TWon/hw-1.o'
clang: error: no input files
error: fatalError
The frontend generates /var/folders/cl/z48nl9xx18307rwb9l42n2yr0000gn/T/TemporaryDirectory.IYWkMJ/hw-2.o but then tries to link /var/folders/cl/z48nl9xx18307rwb9l42n2yr0000gn/T/TemporaryDirectory.IYWkMJ/hw-1.o
$ SWIFT_EXEC=/Users/ryan_mansfield/swift/build/Ninja-RelWithDebInfoAssert/swiftdriver-macosx-arm64/arm64-apple-macosx10.14/release/bin/swiftc SWIFT_DRIVER_SWIFT_FRONTEND_EXEC=~/swift/build/Ninja-ReleaseAssert/swift-macosx-arm64/bin/swift-frontend swiftc -enable-batch-mode ~/hw.swift -v
Swift version 6.0-dev (LLVM 57177aa1b91540b, Swift 85c0555c89e568d)
Target: arm64-apple-macosx14.0
/Users/ryan_mansfield/swift/build/Ninja-ReleaseAssert/swift-macosx-arm64/bin/swift-frontend -frontend -c -primary-file /Users/ryan_mansfield/hw.swift -target arm64-apple-macosx14.0 -Xllvm -aarch64-use-tbi -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk -color-diagnostics -new-driver-path /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-driver -empty-abi-descriptor -resource-dir /Users/ryan_mansfield/swift/build/Ninja-ReleaseAssert/swift-macosx-arm64/lib/swift -module-name hw -disable-clang-spi -target-sdk-version 14.4 -target-sdk-name macosx14.4 -external-plugin-path '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/usr/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/usr/bin/swift-plugin-server' -external-plugin-path '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/usr/local/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/usr/bin/swift-plugin-server' -external-plugin-path '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server' -external-plugin-path '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/local/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server' -plugin-path /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/host/plugins -plugin-path /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/local/lib/swift/host/plugins -o /var/folders/cl/z48nl9xx18307rwb9l42n2yr0000gn/T/TemporaryDirectory.IYWkMJ/hw-2.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang /var/folders/cl/z48nl9xx18307rwb9l42n2yr0000gn/T/TemporaryDirectory.IYWkMJ/hw-1.o --sysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk --target=arm64-apple-macosx14.0 -L /Users/ryan_mansfield/swift/build/Ninja-ReleaseAssert/swift-macosx-arm64/lib/swift/macosx -L /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/usr/lib/swift -o hw
error: link command failed with exit code 1 (use -v to see invocation)
clang: error: no such file or directory: '/var/folders/cl/z48nl9xx18307rwb9l42n2yr0000gn/T/TemporaryDirectory.IYWkMJ/hw-1.o'
clang: error: no input files
error: fatalError
Using the older driver works:
$ SWIFT_USE_OLD_DRIVER=1 SWIFT_EXEC=/Users/ryan_mansfield/swift/build/Ninja-RelWithDebInfoAssert/swiftdriver-macosx-arm64/arm64-apple-macosx10.15/release/bin/swiftc SWIFT_DRIVER_SWIFT_FRONTEND_EXEC=~/swift/build/Ninja-ReleaseAssert/swift-macosx-arm64/bin/swift-frontend swiftc -enable-batch-mode ~/hw.swift
<unknown>:0: warning: legacy driver is now deprecated; consider avoiding specifying 'SWIFT_USE_OLD_DRIVER'
$ echo $?
0
Expected behavior
Link executable successfully.
Environment
Swift version 6.0-dev (LLVM 57177aa1b91540b, Swift 85c0555c89e568d)
Additional information
No response