mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Frontend: add -autolink-library= option to support Windows
All modules on Windows need to link against one of {libcmtd.lib, libcmt.lib,
msvcrtd.lib, msvcrt.lib}. In addition to being the C library, it is the
equivalent of crtbegin0.o on other targets. It is responsible for providing the
entry point itself. Traditionally, cl will embed the linkage requirement into
all objects based on the flags given -- one of {/MTd, /MT, /MDd, /MD}. clang
emulates this via the `--dependent-lib=` option. Emulate that behaviour in the
swift driver so that swift objects being compiled for Windows targets can
auto-link to the required libraries.
This commit is contained in:
@@ -1285,6 +1285,9 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args,
|
||||
Opts.EnableReflectionNames = false;
|
||||
}
|
||||
|
||||
for (const auto &Lib : Args.getAllArgValues(options::OPT_autolink_library))
|
||||
Opts.LinkLibraries.push_back(LinkLibrary(Lib, LibraryKind::Library));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user