Add -linker command-line option (#2386)

To set the linker executable for MSVC targets (e.g., `lld-link`) or the
`-fuse-ld` arg for the gcc linking command-line for the other targets.
This commit is contained in:
kinke 2017-10-28 01:21:24 +02:00 committed by GitHub
parent fa3a78174f
commit aeaf35c42f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 3 deletions

View file

@ -62,8 +62,6 @@ int linkObjToBinaryMSVC(llvm::StringRef outputPath, bool useInternalLinker,
windows::setupMsvcEnvironment();
#endif
const std::string tool = "link.exe";
// build arguments
std::vector<std::string> args;
@ -180,5 +178,9 @@ int linkObjToBinaryMSVC(llvm::StringRef outputPath, bool useInternalLinker,
#endif
// try to call linker
return executeToolAndWait(tool, args, global.params.verbose);
std::string linker = opts::linker;
if (linker.empty())
linker = "link.exe";
return executeToolAndWait(linker, args, global.params.verbose);
}