https://github.com/mgorny created https://github.com/llvm/llvm-project/pull/127345
Fix `tools::addFortranRuntimeLibraryPath` to use `CLANG_INSTALL_LIBDIR_BASENAME` rather than hardwired `lib` directory. This fixes flang being unable to find its runtime when installed into nonstandard directory on a system using `lib64` for 64-bit libraries. While technically flang runtime could be installed with a different libdir value than clang, it seems rather unlikely. From a41cebcc8f7887864de2a0447d64faa9c95e02b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgo...@gentoo.org> Date: Sat, 15 Feb 2025 21:00:16 +0100 Subject: [PATCH] [clang] [Driver] Fix respecting libdir when locating flang runtime Fix `tools::addFortranRuntimeLibraryPath` to use `CLANG_INSTALL_LIBDIR_BASENAME` rather than hardwired `lib` directory. This fixes flang being unable to find its runtime when installed into nonstandard directory on a system using `lib64` for 64-bit libraries. While technically flang runtime could be installed with a different libdir value than clang, it seems rather unlikely. --- clang/lib/Driver/ToolChains/CommonArgs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp index 2d01943ca1ac4..47e6fd9dbf902 100644 --- a/clang/lib/Driver/ToolChains/CommonArgs.cpp +++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -1367,7 +1367,7 @@ void tools::addFortranRuntimeLibraryPath(const ToolChain &TC, // lib64 instead of lib. SmallString<256> DefaultLibPath = llvm::sys::path::parent_path(TC.getDriver().Dir); - llvm::sys::path::append(DefaultLibPath, "lib"); + llvm::sys::path::append(DefaultLibPath, CLANG_INSTALL_LIBDIR_BASENAME); if (TC.getTriple().isKnownWindowsMSVCEnvironment()) CmdArgs.push_back(Args.MakeArgString("-libpath:" + DefaultLibPath)); else _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits