···11+diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake
22+index 37364341ff8b..7f74c1a3e257 100644
33+--- a/cmake/modules/LLDBConfig.cmake
44++++ b/cmake/modules/LLDBConfig.cmake
55+@@ -257,7 +257,7 @@ if (NOT TARGET clang-resource-headers)
66+ # Iterate over the possible places where the external resource directory
77+ # could be and pick the first that exists.
88+ foreach(CANDIDATE "${Clang_DIR}/../.." "${LLVM_DIR}" "${LLVM_LIBRARY_DIRS}"
99+- "${LLVM_BUILD_LIBRARY_DIR}"
1010++ "${LLVM_BUILD_LIBRARY_DIR}" "@clangLibDir@"
1111+ "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}")
1212+ # Build the resource directory path by appending 'clang/<version number>'.
1313+ set(CANDIDATE_RESOURCE_DIR "${CANDIDATE}/clang/${LLDB_CLANG_RESOURCE_DIR_NAME}")
···11+diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
22+index 94d426b..37f7794 100644
33+--- a/tools/llvm-config/llvm-config.cpp
44++++ b/tools/llvm-config/llvm-config.cpp
55+@@ -333,6 +333,21 @@ int main(int argc, char **argv) {
66+ ActiveIncludeOption = "-I" + ActiveIncludeDir;
77+ }
88+99++ /// Nix-specific multiple-output handling: override ActiveLibDir if --link-shared
1010++ if (!IsInDevelopmentTree) {
1111++ bool WantShared = true;
1212++ for (int i = 1; i < argc; ++i) {
1313++ StringRef Arg = argv[i];
1414++ if (Arg == "--link-shared")
1515++ WantShared = true;
1616++ else if (Arg == "--link-static")
1717++ WantShared = false; // the last one wins
1818++ }
1919++
2020++ if (WantShared)
2121++ ActiveLibDir = std::string("@lib@") + "/lib" + LLVM_LIBDIR_SUFFIX;
2222++ }
2323++
2424+ /// We only use `shared library` mode in cases where the static library form
2525+ /// of the components provided are not available; note however that this is
2626+ /// skipped if we're run from within the build dir. However, once installed,
···11+{ lib
22+, stdenv
33+, llvm_meta
44+, src
55+, cmake
66+, llvm
77+, perl
88+, version
99+}:
1010+1111+stdenv.mkDerivation rec {
1212+ pname = "openmp";
1313+ inherit version;
1414+1515+ inherit src;
1616+ sourceRoot = "source/${pname}";
1717+1818+ nativeBuildInputs = [ cmake perl ];
1919+ buildInputs = [ llvm ];
2020+2121+ meta = llvm_meta // {
2222+ homepage = "https://openmp.llvm.org/";
2323+ description = "Support for the OpenMP language";
2424+ longDescription = ''
2525+ The OpenMP subproject of LLVM contains the components required to build an
2626+ executable OpenMP program that are outside the compiler itself.
2727+ Contains the code for the runtime library against which code compiled by
2828+ "clang -fopenmp" must be linked before it can run and the library that
2929+ supports offload to target devices.
3030+ '';
3131+ # "All of the code is dual licensed under the MIT license and the UIUC
3232+ # License (a BSD-like license)":
3333+ license = with lib.licenses; [ mit ncsa ];
3434+ };
3535+}