[flang-commits] [flang] [flang] Add flag to disable Float128 runtime (PR #110116)

David Truby via flang-commits flang-commits at lists.llvm.org
Thu Sep 26 05:31:49 PDT 2024


https://github.com/DavidTruby created https://github.com/llvm/llvm-project/pull/110116

Some of the Float128 runtime doesn't build with non-glibc linux targets,
e.g. musl and bionic. Until we can investigate and fix this, an easy fix
is to add a cmake flag to disable the float128 runtime.


>From d4e4878286c1101734db727a768251f423c1e32e Mon Sep 17 00:00:00 2001
From: David Truby <david.truby at arm.com>
Date: Thu, 26 Sep 2024 13:30:13 +0100
Subject: [PATCH] [flang] Add flag to disable Float128 runtime

Some of the Float128 runtime doesn't build with non-glibc linux targets,
e.g. musl and bionic. Until we can investigate and fix this, an easy fix
is to add a cmake flag to disable the float128 runtime.
---
 flang/runtime/CMakeLists.txt | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/flang/runtime/CMakeLists.txt b/flang/runtime/CMakeLists.txt
index 0ad1b718d5875b..b77c51a06aab5b 100644
--- a/flang/runtime/CMakeLists.txt
+++ b/flang/runtime/CMakeLists.txt
@@ -103,7 +103,13 @@ append(${NO_LTO_FLAGS} CMAKE_CXX_FLAGS)
 add_definitions(-U_GLIBCXX_ASSERTIONS)
 add_definitions(-U_LIBCPP_ENABLE_ASSERTIONS)
 
-add_subdirectory(Float128Math)
+set(FLANG_RUNTIME_ENABLE_F128 On CACHE BOOL
+  "Specifies whether to build the IEEE-754 128-bit float math support in the\
+   Flang runtime. This is unsupported on certain platforms.")
+
+if (FLANG_RUNTIME_ENABLE_F128)
+  add_subdirectory(Float128Math)
+endif()
 
 set(sources
   ISO_Fortran_binding.cpp
@@ -232,7 +238,7 @@ set(supported_files
 enable_cuda_compilation(FortranRuntime "${supported_files}")
 enable_omp_offload_compilation("${supported_files}")
 
-if (NOT TARGET FortranFloat128Math)
+if (FLANG_RUNTIME_ENABLE_F128 AND NOT TARGET FortranFloat128Math)
   # If FortranFloat128Math is not defined, then we are not building
   # standalone FortranFloat128Math library. Instead, include
   # the relevant sources into FortranRuntime itself.



More information about the flang-commits mailing list