llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Abhina Sree (abhina-sree) <details> <summary>Changes</summary> This patch fixes the following build error on z/OS `error: unknown type name 'Dl_info'` by adding a guard to check if we have dladdr. --- Full diff: https://github.com/llvm/llvm-project/pull/75637.diff 1 Files Affected: - (modified) clang/tools/libclang/CIndexer.cpp (+7-1) ``````````diff diff --git a/clang/tools/libclang/CIndexer.cpp b/clang/tools/libclang/CIndexer.cpp index 77da2e4fa5ead0..41f8a6f2dac5fb 100644 --- a/clang/tools/libclang/CIndexer.cpp +++ b/clang/tools/libclang/CIndexer.cpp @@ -125,13 +125,19 @@ const std::string &CIndexer::getClangResourcesPath() { #elif defined(_AIX) getClangResourcesPathImplAIX(LibClangPath); #else + bool pathNotFound = false; +#if defined(HAVE_DLFCN_H) && defined(HAVE_DLADDR) Dl_info info; std::string Path; // This silly cast below avoids a C++ warning. if (dladdr((void *)(uintptr_t)clang_createTranslationUnit, &info) != 0) { // We now have the CIndex directory, locate clang relative to it. LibClangPath += info.dli_fname; - } else if (!(Path = llvm::sys::fs::getMainExecutable(nullptr, nullptr)).empty()) { + } else + pathNotFound = true; +#endif + if (pathNotFound && + !(Path = llvm::sys::fs::getMainExecutable(nullptr, nullptr)).empty()) { // If we can't get the path using dladdr, try to get the main executable // path. This may be needed when we're statically linking libclang with // musl libc, for example. `````````` </details> https://github.com/llvm/llvm-project/pull/75637 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits