mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-14 07:09:50 +03:00
Use config file's lib-dirs
when searching for compiler-rt libs
In addition (and preferred over) the previous searched-for lib dir (`<bin dir>/../lib<LIB_SUFFIX CMake var>`). [Incl. searching in some of their subdirs, e.g., `clang/x.y.z/lib/<OS>`.] I skipped that backwards-compatibility thingy for the builtins lib on Windows (not crucial, only linked (if found) on Windows etc.).
This commit is contained in:
parent
ac070a386d
commit
a29d5fd53e
2 changed files with 68 additions and 52 deletions
|
@ -18,6 +18,7 @@
|
|||
#include "gen/logger.h"
|
||||
|
||||
#include "llvm/Support/FileSystem.h"
|
||||
#include "llvm/Support/Path.h"
|
||||
|
||||
#if LDC_WITH_LLD
|
||||
#if LDC_LLVM_VER >= 600
|
||||
|
@ -60,9 +61,14 @@ void addMscrtLibs(std::vector<std::string> &args) {
|
|||
}
|
||||
|
||||
void addLibIfFound(std::vector<std::string> &args, const llvm::Twine &name) {
|
||||
std::string candidate = exe_path::prependLibDir(name);
|
||||
if (llvm::sys::fs::exists(candidate))
|
||||
args.push_back(std::move(candidate));
|
||||
for (const char *dir : ConfigFile::instance.libDirs()) {
|
||||
llvm::SmallString<128> candidate(dir);
|
||||
llvm::sys::path::append(candidate, name);
|
||||
if (llvm::sys::fs::exists(candidate)) {
|
||||
args.push_back(candidate.str());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void addSanitizerLibs(std::vector<std::string> &args) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue