···1+diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake
2+index 37364341ff8b..7f74c1a3e257 100644
3+--- a/cmake/modules/LLDBConfig.cmake
4++++ b/cmake/modules/LLDBConfig.cmake
5+@@ -257,7 +257,7 @@ if (NOT TARGET clang-resource-headers)
6+ # Iterate over the possible places where the external resource directory
7+ # could be and pick the first that exists.
8+ foreach(CANDIDATE "${Clang_DIR}/../.." "${LLVM_DIR}" "${LLVM_LIBRARY_DIRS}"
9+- "${LLVM_BUILD_LIBRARY_DIR}"
10++ "${LLVM_BUILD_LIBRARY_DIR}" "@clangLibDir@"
11+ "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}")
12+ # Build the resource directory path by appending 'clang/<version number>'.
13+ set(CANDIDATE_RESOURCE_DIR "${CANDIDATE}/clang/${LLDB_CLANG_RESOURCE_DIR_NAME}")
···1+diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
2+index 94d426b..37f7794 100644
3+--- a/tools/llvm-config/llvm-config.cpp
4++++ b/tools/llvm-config/llvm-config.cpp
5+@@ -333,6 +333,21 @@ int main(int argc, char **argv) {
6+ ActiveIncludeOption = "-I" + ActiveIncludeDir;
7+ }
8+9++ /// Nix-specific multiple-output handling: override ActiveLibDir if --link-shared
10++ if (!IsInDevelopmentTree) {
11++ bool WantShared = true;
12++ for (int i = 1; i < argc; ++i) {
13++ StringRef Arg = argv[i];
14++ if (Arg == "--link-shared")
15++ WantShared = true;
16++ else if (Arg == "--link-static")
17++ WantShared = false; // the last one wins
18++ }
19++
20++ if (WantShared)
21++ ActiveLibDir = std::string("@lib@") + "/lib" + LLVM_LIBDIR_SUFFIX;
22++ }
23++
24+ /// We only use `shared library` mode in cases where the static library form
25+ /// of the components provided are not available; note however that this is
26+ /// skipped if we're run from within the build dir. However, once installed,
···1+{ lib
2+, stdenv
3+, llvm_meta
4+, src
5+, cmake
6+, llvm
7+, perl
8+, version
9+}:
10+11+stdenv.mkDerivation rec {
12+ pname = "openmp";
13+ inherit version;
14+15+ inherit src;
16+ sourceRoot = "source/${pname}";
17+18+ nativeBuildInputs = [ cmake perl ];
19+ buildInputs = [ llvm ];
20+21+ meta = llvm_meta // {
22+ homepage = "https://openmp.llvm.org/";
23+ description = "Support for the OpenMP language";
24+ longDescription = ''
25+ The OpenMP subproject of LLVM contains the components required to build an
26+ executable OpenMP program that are outside the compiler itself.
27+ Contains the code for the runtime library against which code compiled by
28+ "clang -fopenmp" must be linked before it can run and the library that
29+ supports offload to target devices.
30+ '';
31+ # "All of the code is dual licensed under the MIT license and the UIUC
32+ # License (a BSD-like license)":
33+ license = with lib.licenses; [ mit ncsa ];
34+ };
35+}