mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-04 00:55:49 +03:00
Integrate LLD for MSVC targets via experimental CMake option LDC_WITH_LLD
Results in a 7.5% bigger RelWithDebInfo ldc2.exe on Win64 with LLVM 3.9.1. LLD is currently enforced when building with LDC_WITH_LLD=ON. And LLD still doesn't support debuginfo (.pdb) generation for MSVC targets.
This commit is contained in:
parent
ede23642ef
commit
00d5f9b5b5
5 changed files with 62 additions and 32 deletions
|
@ -12,6 +12,10 @@
|
|||
#include "driver/tool.h"
|
||||
#include "gen/logger.h"
|
||||
|
||||
#if LDC_WITH_LLD
|
||||
#include "lld/Driver/Driver.h"
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static llvm::cl::opt<std::string> mscrtlib(
|
||||
|
@ -160,6 +164,20 @@ int linkObjToBinaryMSVC(llvm::StringRef outputPath,
|
|||
}
|
||||
logstr << "\n"; // FIXME where's flush ?
|
||||
|
||||
#if LDC_WITH_LLD
|
||||
const bool useInternalLinker = true; // TODO
|
||||
if (useInternalLinker) {
|
||||
const auto fullArgs =
|
||||
getFullArgs("lld-link.exe", args, global.params.verbose);
|
||||
|
||||
const bool success = lld::coff::link(fullArgs);
|
||||
if (!success)
|
||||
error(Loc(), "linking with LLD failed");
|
||||
|
||||
return success ? 0 : 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
// try to call linker
|
||||
return executeToolAndWait(tool, args, global.params.verbose);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue