When using SPM on Windows to build a `.dynamic` library which only contains C targets, the linker fails with the following error:
Running `swift build -Xswiftc -v` reveals what seems to be the issue:
i.e. the Swift driver appears to be linking swiftrt.obj but not swiftCore.lib (since swift-autolink-extract sees no need for swiftCore.lib because it's a pure C target). Using the driver by itself (instead of through swift build) also produces this issue.
I'm not too familiar with the Swift codebase but an initial search seems to indicate that the issue is caused due to swiftrt.obj being unconditionally linked at lib/Driver/WindowsToolChains.cpp#L134. Running `swift build -Xswiftc -lswiftCore` causes it to link successfully – though I suspect that not linking swiftrt.obj in C-only targets might be the preferred solution.
I've attached a minimal project demonstrating the issue; running `swift build` succeeds on both macOS and Linux, but fails on Windows.