Skip to content

Swift: Omit output-file-map when used as a linker

Swift is used as the linker for non-swift files because it needs to pull files like swiftrt.o in when swift symbols are present to ensure that the swift runtime is linked.

The swift driver uses clang as the underlying linker, which pulls in crtbegin.o and friends when appropriate, so using Swift as a linker for C/C++ libraries is fine.

The output-file-map was getting passed to all Swift invocations. This is fine if the library/executable contains swift sources, since the file gets generated by the Swift compiler for those sources, but it will not exist if the compiler is being used as a linker. In that case, we do not have an output file map and the build will fail if we try to pass one in since the file doesn't exist.

Merge request reports