[flang-commits] [flang] [flang] Fix link error in shared library builds (PR #220550)

David Spickett via flang-commits flang-commits at lists.llvm.org
Wed Sep 2 03:54:17 PDT 2026


https://github.com/DavidSpickett created https://github.com/llvm/llvm-project/pull/220550

Since #218917 / 813bdb184af716091bb927070063a3e065124d33.

Errors of the form:
/usr/bin/ld: <...>/build/./lib/libFortranLower.so.24.0git: error adding symbols: DSO missing from command line

My changes to the constructor changed dependencies. I could either add a dependency on that library,
or refactor it a bit to avoid it.

I don't know if linking that library is a good idea, so I'm going the latter.

>From d8dd668b7cd749353409271be3d64e30e6006d69 Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at arm.com>
Date: Wed, 2 Sep 2026 10:48:59 +0000
Subject: [PATCH] [flang] Fix link error in shared library builds

Since #218917 / 813bdb184af716091bb927070063a3e065124d33.

Errors of the form:
/usr/bin/ld: <...>/build/./lib/libFortranLower.so.24.0git: error adding symbols: DSO missing from command line

My changes to the constructor changed dependencies.
I could either add a dependency on that library,
or refactor it a bit to avoid it.

I don't know if linking that library is a good idea,
so I'm going the latter.
---
 flang/include/flang/Frontend/CompilerInstance.h | 4 ++--
 flang/lib/Frontend/CompilerInstance.cpp         | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/flang/include/flang/Frontend/CompilerInstance.h b/flang/include/flang/Frontend/CompilerInstance.h
index 3909e7bf37bba..842f37290e109 100644
--- a/flang/include/flang/Frontend/CompilerInstance.h
+++ b/flang/include/flang/Frontend/CompilerInstance.h
@@ -111,8 +111,8 @@ class CompilerInstance {
   /// @}
 
 public:
-  explicit CompilerInstance(std::shared_ptr<CompilerInvocation> invocation =
-                                std::make_shared<CompilerInvocation>());
+  CompilerInstance();
+  explicit CompilerInstance(std::shared_ptr<CompilerInvocation> invocation);
 
   ~CompilerInstance();
 
diff --git a/flang/lib/Frontend/CompilerInstance.cpp b/flang/lib/Frontend/CompilerInstance.cpp
index d35f549701282..f1e0b16c08474 100644
--- a/flang/lib/Frontend/CompilerInstance.cpp
+++ b/flang/lib/Frontend/CompilerInstance.cpp
@@ -33,6 +33,9 @@
 
 using namespace Fortran::frontend;
 
+CompilerInstance::CompilerInstance()
+    : CompilerInstance(std::make_shared<CompilerInvocation>()) {}
+
 CompilerInstance::CompilerInstance(
     std::shared_ptr<CompilerInvocation> invocation)
     : invocation(std::move(invocation)),



More information about the flang-commits mailing list