[clang] [Driver] Add linker options to support statical linking to shared flang-rt on AIX. (PR #131822)

Hubert Tong via cfe-commits cfe-commits at lists.llvm.org
Sat Mar 29 17:48:27 PDT 2025


================
@@ -127,9 +127,19 @@ void aix::Linker::ConstructJob(Compilation &C, const JobAction &JA,
   }
 
   // Force static linking when "-static" is present.
-  if (Args.hasArg(options::OPT_static))
+  if (Args.hasArg(options::OPT_static)) {
     CmdArgs.push_back("-bnso");
 
+    if (D.IsFlangMode()) {
+      // The folllowing linker options are needed to statically link to the
+      // shared libflang_rt.runtime.a on AIX
+      CmdArgs.push_back("-bI:/usr/lib/syscalls.exp");
+      CmdArgs.push_back("-bI:/usr/lib/aio.exp");
+      CmdArgs.push_back("-bI:/usr/lib/threads.exp");
+      CmdArgs.push_back("-lcrypt");
+    }
----------------
hubert-reinterpretcast wrote:

Does this add extra options even when `libflang_rt.runtime.a` is not being linked in?
See https://github.com/llvm/llvm-project/blob/main/clang/lib/Driver/ToolChains/AIX.cpp#L359-L365


https://github.com/llvm/llvm-project/pull/131822


More information about the cfe-commits mailing list