[llvm] [openmp] Remaining work necessary for GCC 15 (PR #157385)

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 10 03:58:22 PDT 2025


================
@@ -195,6 +195,14 @@ function (add_flangrt_library name)
       # Use same stem name for .a and .so. Common in UNIX environments.
       # Not possible in Windows environments.
       set_target_properties(${tgtname} PROPERTIES OUTPUT_NAME "${name}")
+
+      # Must use minimum optimization level of -O2 to prevent dependency on libstdc++
+      string(REPLACE "-O0" "-O2" CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS)
+      string(REPLACE "-O1" "-O2" CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS)
+      string(FIND "-O" CMAKE_CXX_FLAGS opt_idx)
+      if (opt_idx EQUAL -1)
+        target_compile_options(${tgtname} PRIVATE -O2)
+      endif ()
----------------
Meinersbur wrote:

This should be in `foreach (tgtname IN LISTS srctargets)`. If building `libflang-rt.runtime.so` as well as `libflang-rt.runtime.so`, the mechanism in add_flang_rt_library adds a library of type that is in srctargets, but not in libtargets. The compiler is invoked on targets in srctargets, linker in libtargets

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


More information about the llvm-commits mailing list