Skip to content

[driver] Generalize the code that adds the path of libflang_rt.runtime.a. #134362

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Apr 13, 2025

Conversation

DanielCChen
Copy link
Contributor

@DanielCChen DanielCChen commented Apr 4, 2025

The PR is to generalize the re-use of the compilerRT code of adding the path of libflang_rt.runtime.a (so) from AIX and LoP only to all platforms via a new function addFlangRTLibPath.

It also added -static-libflangrt and -shared-libflangrt compiler options to allow users choosing which flang-rt to link to. It defaults to shared flang-rt, which is consistent with the linker behavior, except on AIX, it defaults to static.

Also, PR #134320 exposed an issue in PR #131041 that the the overriding addFortranRuntimeLibs is missing the link to libquadmath. This PR also fixed that and restored the test case that PR #131041 broke.

@DanielCChen DanielCChen self-assigned this Apr 4, 2025
@llvmbot llvmbot added clang Clang issues not falling into any other category backend:PowerPC clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' flang:driver flang Flang issues not falling into any other category labels Apr 4, 2025
@llvmbot
Copy link
Member

llvmbot commented Apr 4, 2025

@llvm/pr-subscribers-flang-driver
@llvm/pr-subscribers-backend-powerpc

@llvm/pr-subscribers-clang-driver

Author: Daniel Chen (DanielCChen)

Changes

The PR is to generalize the re-use of the compilerRT code of adding the path of libflang_rt.runtime.a (so) from AIX and LoP only to all platforms via a new function addFlangRTLibPath.

Also, PR #134320 exposed an issue in PR #131041 that the the overriding addFortranRuntimeLibs is missing the link to libquadmath. This PR also fixed that and restored the test case that PR #131041 broke.


Full diff: https://github.com/llvm/llvm-project/pull/134362.diff

7 Files Affected:

  • (modified) clang/include/clang/Driver/ToolChain.h (+4)
  • (modified) clang/lib/Driver/ToolChain.cpp (+18-2)
  • (modified) clang/lib/Driver/ToolChains/AIX.cpp (-8)
  • (modified) clang/lib/Driver/ToolChains/AIX.h (-3)
  • (modified) clang/lib/Driver/ToolChains/PPCLinux.cpp (-16)
  • (modified) clang/lib/Driver/ToolChains/PPCLinux.h (-3)
  • (modified) flang/test/Driver/linker-flags.f90 (+1-1)
diff --git a/clang/include/clang/Driver/ToolChain.h b/clang/include/clang/Driver/ToolChain.h
index 076e4296c3090..d0059673d6a67 100644
--- a/clang/include/clang/Driver/ToolChain.h
+++ b/clang/include/clang/Driver/ToolChain.h
@@ -521,6 +521,10 @@ class ToolChain {
   addFortranRuntimeLibraryPath(const llvm::opt::ArgList &Args,
                                llvm::opt::ArgStringList &CmdArgs) const;
 
+  /// Add the path for libflang_rt.runtime.a
+  void addFlangRTLibPath(const llvm::opt::ArgList &Args,
+                         llvm::opt::ArgStringList &CmdArgs) const;
+
   const char *getCompilerRTArgString(const llvm::opt::ArgList &Args,
                                      StringRef Component,
                                      FileType Type = ToolChain::FT_Static,
diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index 36d0ae34dec86..054618a44d7bc 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -816,8 +816,7 @@ void ToolChain::addFortranRuntimeLibs(const ArgList &Args,
       if (AsNeeded)
         addAsNeededOption(*this, Args, CmdArgs, /*as_needed=*/false);
     }
-    CmdArgs.push_back("-lflang_rt.runtime");
-    addArchSpecificRPath(*this, Args, CmdArgs);
+    addFlangRTLibPath(Args, CmdArgs);
 
     // needs libexecinfo for backtrace functions
     if (getTriple().isOSFreeBSD() || getTriple().isOSNetBSD() ||
@@ -850,6 +849,23 @@ void ToolChain::addFortranRuntimeLibraryPath(const llvm::opt::ArgList &Args,
     CmdArgs.push_back(Args.MakeArgString("-L" + DefaultLibPath));
 }
 
+void ToolChain::addFlangRTLibPath(const ArgList &Args,
+                                  llvm::opt::ArgStringList &CmdArgs) const {
+  // Link static flang_rt.runtime.a or shared flang_rt.runtime.so
+  const char *Path;
+  if (getVFS().exists(Twine(Path = getCompilerRTArgString(
+                                Args, "runtime", ToolChain::FT_Static, true))))
+    CmdArgs.push_back(Path);
+  else if (getVFS().exists(
+               Twine(Path = getCompilerRTArgString(
+                         Args, "runtime", ToolChain::FT_Shared, true))))
+    CmdArgs.push_back(Path);
+  else {
+    CmdArgs.push_back("-lflang_rt.runtime");
+    addArchSpecificRPath(*this, Args, CmdArgs);
+  }
+}
+
 // Android target triples contain a target version. If we don't have libraries
 // for the exact target version, we should fall back to the next newest version
 // or a versionless path, if any.
diff --git a/clang/lib/Driver/ToolChains/AIX.cpp b/clang/lib/Driver/ToolChains/AIX.cpp
index 26b9d4c772be6..5dc80bc5a3d25 100644
--- a/clang/lib/Driver/ToolChains/AIX.cpp
+++ b/clang/lib/Driver/ToolChains/AIX.cpp
@@ -608,14 +608,6 @@ void AIX::addProfileRTLibs(const llvm::opt::ArgList &Args,
   ToolChain::addProfileRTLibs(Args, CmdArgs);
 }
 
-void AIX::addFortranRuntimeLibs(const ArgList &Args,
-                                llvm::opt::ArgStringList &CmdArgs) const {
-  // Link flang_rt.runtime.a. On AIX, the static and shared library are all
-  // named .a
-  CmdArgs.push_back(
-      getCompilerRTArgString(Args, "runtime", ToolChain::FT_Static, true));
-}
-
 ToolChain::CXXStdlibType AIX::GetDefaultCXXStdlibType() const {
   return ToolChain::CST_Libcxx;
 }
diff --git a/clang/lib/Driver/ToolChains/AIX.h b/clang/lib/Driver/ToolChains/AIX.h
index 17e8370cd1218..8f130f6b54547 100644
--- a/clang/lib/Driver/ToolChains/AIX.h
+++ b/clang/lib/Driver/ToolChains/AIX.h
@@ -87,9 +87,6 @@ class LLVM_LIBRARY_VISIBILITY AIX : public ToolChain {
   void addProfileRTLibs(const llvm::opt::ArgList &Args,
                         llvm::opt::ArgStringList &CmdArgs) const override;
 
-  void addFortranRuntimeLibs(const llvm::opt::ArgList &Args,
-                             llvm::opt::ArgStringList &CmdArgs) const override;
-
   CXXStdlibType GetDefaultCXXStdlibType() const override;
 
   RuntimeLibType GetDefaultRuntimeLibType() const override;
diff --git a/clang/lib/Driver/ToolChains/PPCLinux.cpp b/clang/lib/Driver/ToolChains/PPCLinux.cpp
index 575e88c6ab124..0ed0f91ad166c 100644
--- a/clang/lib/Driver/ToolChains/PPCLinux.cpp
+++ b/clang/lib/Driver/ToolChains/PPCLinux.cpp
@@ -12,7 +12,6 @@
 #include "clang/Driver/Options.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Path.h"
-#include "llvm/Support/VirtualFileSystem.h"
 
 using namespace clang::driver;
 using namespace clang::driver::toolchains;
@@ -102,18 +101,3 @@ bool PPCLinuxToolChain::SupportIEEEFloat128(
   return GlibcSupportsFloat128((Twine(D.DyldPrefix) + Linker).str()) &&
          !(D.CCCIsCXX() && HasUnsupportedCXXLib);
 }
-
-void PPCLinuxToolChain::addFortranRuntimeLibs(
-    const ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const {
-  // Link static flang_rt.runtime.a or shared flang_rt.runtime.so
-  const char *Path;
-  if (getVFS().exists(Twine(Path = getCompilerRTArgString(
-                                Args, "runtime", ToolChain::FT_Static, true))))
-    CmdArgs.push_back(Path);
-  else if (getVFS().exists(
-               Twine(Path = getCompilerRTArgString(
-                         Args, "runtime", ToolChain::FT_Shared, true))))
-    CmdArgs.push_back(Path);
-  else
-    CmdArgs.push_back("-lflang_rt.runtime");
-}
diff --git a/clang/lib/Driver/ToolChains/PPCLinux.h b/clang/lib/Driver/ToolChains/PPCLinux.h
index 910df3d16e6a5..63adaff6be9c2 100644
--- a/clang/lib/Driver/ToolChains/PPCLinux.h
+++ b/clang/lib/Driver/ToolChains/PPCLinux.h
@@ -24,9 +24,6 @@ class LLVM_LIBRARY_VISIBILITY PPCLinuxToolChain : public Linux {
   AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
                             llvm::opt::ArgStringList &CC1Args) const override;
 
-  void addFortranRuntimeLibs(const llvm::opt::ArgList &Args,
-                             llvm::opt::ArgStringList &CmdArgs) const override;
-
 private:
   bool SupportIEEEFloat128(const Driver &D, const llvm::Triple &Triple,
                            const llvm::opt::ArgList &Args) const;
diff --git a/flang/test/Driver/linker-flags.f90 b/flang/test/Driver/linker-flags.f90
index 20104276d2e4a..4e62a8c32d360 100644
--- a/flang/test/Driver/linker-flags.f90
+++ b/flang/test/Driver/linker-flags.f90
@@ -2,7 +2,7 @@
 ! invocation. These libraries are added on top of other standard runtime
 ! libraries that the Clang driver will include.
 
-! RUN: %flang -### --target=ppc64le-linux-gnu %S/Inputs/hello.f90 2>&1 | FileCheck %s --check-prefixes=CHECK,UNIX,UNIX-F128NONE
+! RUN: %flang -### --target=ppc64le-linux-gnu %S/Inputs/hello.f90 2>&1 | FileCheck %s --check-prefixes=CHECK,UNIX,UNIX-F128%f128-lib
 ! RUN: %flang -### --target=aarch64-apple-darwin %S/Inputs/hello.f90 2>&1 | FileCheck %s --check-prefixes=CHECK,DARWIN,DARWIN-F128%f128-lib
 ! RUN: %flang -### --target=sparc-sun-solaris2.11 %S/Inputs/hello.f90 2>&1 | FileCheck %s --check-prefixes=CHECK,UNIX,SOLARIS-F128%f128-lib
 ! RUN: %flang -### --target=x86_64-unknown-freebsd %S/Inputs/hello.f90 2>&1 | FileCheck %s --check-prefixes=CHECK,BSD,BSD-F128%f128-lib

@vzakhari
Copy link
Contributor

vzakhari commented Apr 4, 2025

Can you please explain why you want to link the static library by default? For example, Clang has these options https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-static-libgcc that allow users to force the static linking, and, I think, by default it links shared compiler support libraries.

Also, how does the full path linking of the shared library works with -frtlib-add-rpath?

Copy link
Contributor

@tarunprabhu tarunprabhu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@vzakhari
Copy link
Contributor

vzakhari commented Apr 5, 2025

May I ask not to merge this yet? I have a question above, but I will not be at work until next Thursday to discuss this in a timely manner.

@DanielCChen
Copy link
Contributor Author

May I ask not to merge this yet? I have a question above, but I will not be at work until next Thursday to discuss this in a timely manner.

@vzakhari Sure, I will wait until you come back.

@DanielCChen
Copy link
Contributor Author

Can you please explain why you want to link the static library by default? For example, Clang has these options https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-static-libgcc that allow users to force the static linking, and, I think, by default it links shared compiler support libraries.

Also, how does the full path linking of the shared library works with -frtlib-add-rpath?

The flang-rt cmake is using the similar frame work to how compiler-rt is built. It publishes libflang_rt.runtime.* to the Clang resource_dir no matter if it is static or shared although resource_dir is normally for static libs. As your link points out, unlike Clang, Flang currently does not have a compiler option to switch between linking to the static or shared flang-rt, so the current order in this PR does not dictate the default.
As the next step, I am planning to add a compiler option -static-libflang_rt that is similar to -static-libgcc for that purpose (or -dynamic-libflang_rt if we decide to link static flang-rt as default).

As for the frtlib-add-rpath, The current code before this PR is passing -L/resource_dir/ -lflan_rt.runtime to the linker. If the shared flang-rt is present in the resource_dir, the linker "prefers" the shared flang-rt. Users will need to specify -frtlib-add-rpath in order to link to the shared flang-rt.
The full path linking should not affect that behavior. Users still need the -frtlib-add-rpath option to link to the shared flang-rt with full path name.

I actually missed that in the shared path in this PR. I will push an amendment.

@Meinersbur
Copy link
Member

Meinersbur commented Apr 7, 2025

This PR may allow us to build the shared library by default

# TODO: Enable by default to increase test coverage, and which version of the
# library should be the user's choice anyway.
# Currently, the Flang driver adds `-L"libdir" -lflang_rt` as linker
# argument, which leaves the choice which library to use to the linker.
# Since most linkers prefer the shared library, this would constitute a
# breaking change unless the driver is changed.
option(FLANG_RT_ENABLE_SHARED "Build Flang-RT as a shared library." OFF)

I would generally prefer if we could avoid having driver behavior depend on the existance of files, but the linker would also pick an existing file as well.

I think the static library should be the default (like libclang_rt.builtins). Most uses will already use the static library unless they went into the effort of building the shared library. Then, flang-rt and flang are version-locked without a versioning scheme (flang_rt.runtime.a.1.0.0) in place. Deploying an executable that depends on such a shared library is not straigtforward.

@DanielCChen
Copy link
Contributor Author

DanielCChen commented Apr 7, 2025

I would generally prefer if we could avoid having driver behavior depend on the existance of files, but the linker would also pick an existing file as well.

Agreed. The if (static exists) - else if (shared exists) logic in this PR is temporary until we have the compiler option to allow users to choose which one to link.
This logic prefers the static flang-rt as if both exist, the static one wins. That being said, if the current behavior (letting the linker to decide when both are available) is desired, I can add both paths.

@DanielCChen
Copy link
Contributor Author

I think the static library should be the default (like libclang_rt.builtins). Most uses will already use the static library unless they went into the effort of building the shared library. Then, flang-rt and flang are version-locked without a versioning scheme (flang_rt.runtime.a.1.0.0) in place. Deploying an executable that depends on such a shared library is not straigtforward.

Agreed to have the static library as default (so I think-dynamic-libflang_rt may be the option to add to change the default linking method if users decide to build and link to the shared flang-rt, which would be different from -static-libgcc).

I posted a question on the Flang general slack channel asking if flang-rt will guarantee the API compatibility, which will require a versioning scheme.

@DanielCChen
Copy link
Contributor Author

I pushed another commit to add -static-libflangrt and -shared-libflangrt options to allow users to choose which flang-rt to link to in response to @vzakhari's comment. It is now defaulting to the shared, which is consistent with the linker behavior.

It defaults to static on AIX.

My apology to the reviewers especially those who have already approved this PR @MaskRay @tarunprabhu.
I am perfectly fine if you prefer to put the addition of these new options in a separate PR.

Copy link
Contributor

@tarunprabhu tarunprabhu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Daniel. I don't think a separate PR is necessary for the changes, but perhaps wait to see if @MaskRay has a different opinion

Copy link
Contributor

@vzakhari vzakhari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update. I have one questions inlined.

@DanielCChen
Copy link
Contributor Author

Thanks for the update. I have one questions inlined.

Thanks for the review!

@mgorny
Copy link
Member

mgorny commented Apr 12, 2025

I find this change quite confusing. It seems that -static-libflangrt now expects entirely different install location than -shared-libflangrt. Furthermore, the location used seems inconsistent with clang, i.e.:

/usr/lib/llvm/21/bin/../../../../lib/clang/21/lib/x86_64-pc-linux-gnu/libflang_rt.runtime.a

whereas clang uses lib/linux/libclang_rt.builtins-x86_64.a and so on.

@mgorny
Copy link
Member

mgorny commented Apr 12, 2025

I find this change quite confusing. It seems that -static-libflangrt now expects entirely different install location than -shared-libflangrt.

Ah, sorry, now I see that -L/usr/lib/llvm/21/bin/../../../../lib/clang/21/lib/x86_64-pc-linux-gnu is also added, so the "resource dir" location should work for both options.

@DanielCChen DanielCChen merged commit 1264d7a into llvm:main Apr 13, 2025
11 checks passed
@DanielCChen DanielCChen deleted the daniel_flang_rt_driver branch April 13, 2025 13:22
@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 13, 2025

LLVM Buildbot has detected a new failure on builder lldb-aarch64-ubuntu running on linaro-lldb-aarch64-ubuntu while building clang,flang at step 6 "test".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/59/builds/15937

Here is the relevant piece of the build log for the reference
Step 6 (test) failure: build (failure)
...
PASS: lldb-unit :: ValueObject/./LLDBValueObjectTests/8/11 (2113 of 2122)
PASS: lldb-unit :: ValueObject/./LLDBValueObjectTests/9/11 (2114 of 2122)
PASS: lldb-unit :: tools/lldb-server/tests/./LLDBServerTests/0/2 (2115 of 2122)
PASS: lldb-unit :: tools/lldb-server/tests/./LLDBServerTests/1/2 (2116 of 2122)
PASS: lldb-unit :: Utility/./UtilityTests/4/9 (2117 of 2122)
PASS: lldb-unit :: Target/./TargetTests/11/14 (2118 of 2122)
PASS: lldb-unit :: Host/./HostTests/9/12 (2119 of 2122)
PASS: lldb-unit :: Host/./HostTests/3/12 (2120 of 2122)
PASS: lldb-unit :: Process/gdb-remote/./ProcessGdbRemoteTests/8/9 (2121 of 2122)
UNRESOLVED: lldb-api :: tools/lldb-server/TestLldbGdbServer.py (2122 of 2122)
******************** TEST 'lldb-api :: tools/lldb-server/TestLldbGdbServer.py' FAILED ********************
Script:
--
/usr/bin/python3.10 /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/dotest.py -u CXXFLAGS -u CFLAGS --env LLVM_LIBS_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./lib --env LLVM_INCLUDE_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/include --env LLVM_TOOLS_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin --arch aarch64 --build-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex --lldb-module-cache-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-lldb/lldb-api --clang-module-cache-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-clang/lldb-api --executable /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/lldb --compiler /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/clang --dsymutil /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/dsymutil --make /usr/bin/gmake --llvm-tools-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin --lldb-obj-root /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/tools/lldb --lldb-libs-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./lib /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/tools/lldb-server -p TestLldbGdbServer.py
--
Exit Code: 1

Command Output (stdout):
--
lldb version 21.0.0git (https://github.com/llvm/llvm-project.git revision 1264d7a53a4de3094672be2a248db57b213f33ac)
  clang revision 1264d7a53a4de3094672be2a248db57b213f33ac
  llvm revision 1264d7a53a4de3094672be2a248db57b213f33ac
Skipping the following test categories: ['libc++', 'dsym', 'gmodules', 'debugserver', 'objc']

--
Command Output (stderr):
--
UNSUPPORTED: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_Hc_then_Csignal_signals_correct_thread_launch_debugserver (TestLldbGdbServer.LldbGdbServerTestCase) (test case does not fall in any category of interest for this run) 
PASS: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_Hc_then_Csignal_signals_correct_thread_launch_llgs (TestLldbGdbServer.LldbGdbServerTestCase)
PASS: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_Hg_fails_on_another_pid_llgs (TestLldbGdbServer.LldbGdbServerTestCase)
PASS: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_Hg_fails_on_minus_one_pid_llgs (TestLldbGdbServer.LldbGdbServerTestCase)
PASS: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_Hg_fails_on_zero_pid_llgs (TestLldbGdbServer.LldbGdbServerTestCase)
UNSUPPORTED: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_Hg_switches_to_3_threads_launch_debugserver (TestLldbGdbServer.LldbGdbServerTestCase) (test case does not fall in any category of interest for this run) 
PASS: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_Hg_switches_to_3_threads_launch_llgs (TestLldbGdbServer.LldbGdbServerTestCase)
UNSUPPORTED: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_P_and_p_thread_suffix_work_debugserver (TestLldbGdbServer.LldbGdbServerTestCase) (test case does not fall in any category of interest for this run) 
PASS: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_P_and_p_thread_suffix_work_llgs (TestLldbGdbServer.LldbGdbServerTestCase)
UNSUPPORTED: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_P_writes_all_gpr_registers_debugserver (TestLldbGdbServer.LldbGdbServerTestCase) (test case does not fall in any category of interest for this run) 
PASS: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_P_writes_all_gpr_registers_llgs (TestLldbGdbServer.LldbGdbServerTestCase)
UNSUPPORTED: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_attach_commandline_continue_app_exits_debugserver (TestLldbGdbServer.LldbGdbServerTestCase) (test case does not fall in any category of interest for this run) 
Program aborted due to an unhandled Error:
Operation not permitted
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/lldb-server gdbserver --attach=3738682 --reverse-connect [127.0.0.1]:42141
 #0 0x0000aaaac89e1464 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/lldb-server+0x6d1464)
 #1 0x0000aaaac89df464 llvm::sys::RunSignalHandlers() (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/lldb-server+0x6cf464)
 #2 0x0000aaaac89e1b6c SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #3 0x0000ffffabd457dc (linux-vdso.so.1+0x7dc)
 #4 0x0000ffffab54f1f0 __pthread_kill_implementation ./nptl/pthread_kill.c:44:76

@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 13, 2025

LLVM Buildbot has detected a new failure on builder openmp-s390x-linux running on systemz-1 while building clang,flang at step 6 "test-openmp".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/88/builds/10376

Here is the relevant piece of the build log for the reference
Step 6 (test-openmp) failure: test (failure)
******************** TEST 'libomp :: tasking/issue-94260-2.c' FAILED ********************
Exit Code: -11

Command Output (stdout):
--
# RUN: at line 1
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/./bin/clang -fopenmp   -I /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -I /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.src/openmp/runtime/test -L /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/runtime/src  -fno-omit-frame-pointer -mbackchain -I /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.src/openmp/runtime/test/ompt /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.src/openmp/runtime/test/tasking/issue-94260-2.c -o /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/runtime/test/tasking/Output/issue-94260-2.c.tmp -lm -latomic && /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/runtime/test/tasking/Output/issue-94260-2.c.tmp
# executed command: /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/./bin/clang -fopenmp -I /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -I /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.src/openmp/runtime/test -L /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -fno-omit-frame-pointer -mbackchain -I /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.src/openmp/runtime/test/ompt /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.src/openmp/runtime/test/tasking/issue-94260-2.c -o /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/runtime/test/tasking/Output/issue-94260-2.c.tmp -lm -latomic
# executed command: /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/runtime/test/tasking/Output/issue-94260-2.c.tmp
# note: command had no output on stdout or stderr
# error: command failed with exit status: -11

--

********************


var-const pushed a commit to ldionne/llvm-project that referenced this pull request Apr 17, 2025
…e.a. (llvm#134362)

The PR is to generalize the re-use of the `compilerRT` code of adding
the path of `libflang_rt.runtime.a (so)` from AIX and LoP only to all
platforms via a new function `addFlangRTLibPath`.

It also added `-static-libflangrt` and `-shared-libflangrt` compiler
options to allow users choosing which `flang-rt` to link to. It defaults
to shared `flang-rt`, which is consistent with the linker behavior,
except on AIX, it defaults to static.

Also, PR llvm#134320 exposed an issue in PR llvm#131041 that the the overriding
`addFortranRuntimeLibs` is missing the link to `libquadmath`. This PR
also fixed that and restored the test case that PR llvm#131041 broke.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:PowerPC clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang Clang issues not falling into any other category flang:driver flang Flang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants