mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-06 19:06:02 +03:00
If the LLVM is shared, add its lib dir to the hardcoded list used for library lookups
When looking up the LTO linker plugin and compiler-rt libraries.
This commit is contained in:
parent
01555c47d5
commit
282ade3e31
2 changed files with 21 additions and 1 deletions
|
@ -486,6 +486,10 @@ append("-DLDC_LLVM_VER=${LDC_LLVM_VER}" LDC_CXXFLAGS)
|
||||||
append("\"-DLDC_LIBDIR_SUFFIX=R\\\"(${LIB_SUFFIX})\\\"\"" LDC_CXXFLAGS)
|
append("\"-DLDC_LIBDIR_SUFFIX=R\\\"(${LIB_SUFFIX})\\\"\"" LDC_CXXFLAGS)
|
||||||
append("-DLDC_HOST_${D_COMPILER_ID}=1" LDC_CXXFLAGS)
|
append("-DLDC_HOST_${D_COMPILER_ID}=1" LDC_CXXFLAGS)
|
||||||
append("-DLDC_HOST_FE_VER=${D_COMPILER_FE_VERSION}" LDC_CXXFLAGS)
|
append("-DLDC_HOST_FE_VER=${D_COMPILER_FE_VERSION}" LDC_CXXFLAGS)
|
||||||
|
# If the LLVM is shared, add its lib dir to the hardcoded list used for library lookups.
|
||||||
|
if(LLVM_IS_SHARED)
|
||||||
|
append("\"-DLDC_LLVM_LIBDIR=R\\\"(${LLVM_LIBRARY_DIRS})\\\"\"" LDC_CXXFLAGS)
|
||||||
|
endif()
|
||||||
|
|
||||||
#
|
#
|
||||||
# LLD integration (requires headers & libs)
|
# LLD integration (requires headers & libs)
|
||||||
|
|
|
@ -101,6 +101,9 @@ std::string getLTOGoldPluginPath() {
|
||||||
exe_path::prependLibDir("LLVMgold-ldc.so"),
|
exe_path::prependLibDir("LLVMgold-ldc.so"),
|
||||||
// Perhaps the user copied the plugin to LDC's lib dir.
|
// Perhaps the user copied the plugin to LDC's lib dir.
|
||||||
exe_path::prependLibDir("LLVMgold.so"),
|
exe_path::prependLibDir("LLVMgold.so"),
|
||||||
|
#ifdef LDC_LLVM_LIBDIR
|
||||||
|
LDC_LLVM_LIBDIR "/LLVMgold.so",
|
||||||
|
#endif
|
||||||
#if __LP64__
|
#if __LP64__
|
||||||
"/usr/local/lib64/LLVMgold.so",
|
"/usr/local/lib64/LLVMgold.so",
|
||||||
#endif
|
#endif
|
||||||
|
@ -162,6 +165,12 @@ std::string getLTOdylibPath() {
|
||||||
if (llvm::sys::fs::exists(searchPath))
|
if (llvm::sys::fs::exists(searchPath))
|
||||||
return searchPath;
|
return searchPath;
|
||||||
|
|
||||||
|
#ifdef LDC_LLVM_LIBDIR
|
||||||
|
searchPath = LDC_LLVM_LIBDIR "/libLTO.dylib";
|
||||||
|
if (llvm::sys::fs::exists(searchPath))
|
||||||
|
return searchPath;
|
||||||
|
#endif
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -247,14 +256,21 @@ std::string getRelativeClangCompilerRTLibPath(const llvm::Twine &name,
|
||||||
|
|
||||||
void appendFullLibPathCandidates(std::vector<std::string> &paths,
|
void appendFullLibPathCandidates(std::vector<std::string> &paths,
|
||||||
const llvm::Twine &filename) {
|
const llvm::Twine &filename) {
|
||||||
|
llvm::SmallString<128> candidate;
|
||||||
for (const char *dir : ConfigFile::instance.libDirs()) {
|
for (const char *dir : ConfigFile::instance.libDirs()) {
|
||||||
llvm::SmallString<128> candidate(dir);
|
candidate = dir;
|
||||||
llvm::sys::path::append(candidate, filename);
|
llvm::sys::path::append(candidate, filename);
|
||||||
paths.emplace_back(candidate.data(), candidate.size());
|
paths.emplace_back(candidate.data(), candidate.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
// for backwards compatibility
|
// for backwards compatibility
|
||||||
paths.push_back(exe_path::prependLibDir(filename));
|
paths.push_back(exe_path::prependLibDir(filename));
|
||||||
|
|
||||||
|
#ifdef LDC_LLVM_LIBDIR
|
||||||
|
candidate = LDC_LLVM_LIBDIR;
|
||||||
|
llvm::sys::path::append(candidate, filename);
|
||||||
|
paths.emplace_back(candidate.data(), candidate.size());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns candidates of full paths to a compiler-rt lib.
|
// Returns candidates of full paths to a compiler-rt lib.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue