[flang-commits] [flang] [flang][NFC] Fix BUILD_SHARED_LIBS build of FortranUtils (PR #217312)

Eugene Epshteyn via flang-commits flang-commits at lists.llvm.org
Wed Aug 19 06:18:54 PDT 2026


https://github.com/eugeneepshteyn updated https://github.com/llvm/llvm-project/pull/217312

>From d199288fc6962f1a59cffaf47eaeff41a9ba3c66 Mon Sep 17 00:00:00 2001
From: Eugene Epshteyn <eepshteyn at nvidia.com>
Date: Wed, 19 Aug 2026 04:53:59 -0700
Subject: [PATCH] [flang][NFC] Fix BUILD_SHARED_LIBS build of FortranUtils

5ee2778b6072 ("[flang][OpenMP] Reuse canonical default mapper names for
nested mappings") added calls to fir::NameUniquer::deconstruct() and
fir::NameUniquer::doGenerated() in flang/lib/Utils/OpenMP.cpp, but did not
add the library defining them, FIRSupport, to FortranUtils' LINK_LIBS.

With BUILD_SHARED_LIBS=ON, libFortranUtils.so is linked on its own with
-Wl,-z,defs and fails with undefined references to both symbols:

  undefined reference to `fir::NameUniquer::deconstruct(llvm::StringRef)'
  undefined reference to `fir::NameUniquer::doGenerated(
      llvm::ArrayRef<llvm::StringRef>, llvm::ArrayRef<llvm::StringRef>,
      long, llvm::StringRef)'

In the default static build the symbols are resolved at the final
executable link instead, which is why pre-merge CI did not catch this.

This has been breaking the amdgpu-offload-build-only and
amdgpu-offload-ubuntu-22-cmake-build-only builders since that commit.

The equivalent Bazel dependency was already added in 29c2660dc3c6.
---
 flang/lib/Utils/CMakeLists.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/flang/lib/Utils/CMakeLists.txt b/flang/lib/Utils/CMakeLists.txt
index 96c037561a8a5..e73c398834da5 100644
--- a/flang/lib/Utils/CMakeLists.txt
+++ b/flang/lib/Utils/CMakeLists.txt
@@ -17,6 +17,7 @@ add_flang_library(FortranUtils
   LINK_LIBS
   FIRDialect
   FIRBuilder
+  FIRSupport
   FortranEvaluate
   FortranSupport
   HLFIRDialect



More information about the flang-commits mailing list