[clang] 5c8c2b3 - [Flang] Rename libFortranRuntime.a to libflang_rt.runtime.a (#122341)
via cfe-commits
cfe-commits at lists.llvm.org
Sat Feb 8 09:02:58 PST 2025
Author: Michael Kruse
Date: 2025-02-08T18:02:54+01:00
New Revision: 5c8c2b3db54395073e3183f89167156df29dff61
URL: https://github.com/llvm/llvm-project/commit/5c8c2b3db54395073e3183f89167156df29dff61
DIFF: https://github.com/llvm/llvm-project/commit/5c8c2b3db54395073e3183f89167156df29dff61.diff
LOG: [Flang] Rename libFortranRuntime.a to libflang_rt.runtime.a (#122341)
Following the conclusion of the
[RFC](https://discourse.llvm.org/t/rfc-names-for-flang-rt-libraries/84321),
rename Flang's runtime libraries as follows:
* libFortranRuntime.(a|so) to libflang_rt.runtime.(a|so)
* libFortranFloat128Math.a to libflang_rt.quadmath.a
* libCufRuntime_cuda_${CUDAToolkit_VERSION_MAJOR}.(a|so) to
libflang_rt.cuda_${CUDAToolkit_VERSION_MAJOR}.(a|so)
This follows the same naming scheme as Compiler-RT libraries
(`libclang_rt.${component}.(a|so)`). It provides some consistency
between Flang's runtime libraries for current and potential future
library components.
Added:
Modified:
clang/lib/Driver/ToolChains/CommonArgs.cpp
clang/lib/Driver/ToolChains/Flang.cpp
flang/CMakeLists.txt
flang/cmake/modules/AddFlang.cmake
flang/docs/FlangDriver.md
flang/docs/GettingStarted.md
flang/docs/OpenACC-descriptor-management.md
flang/docs/Real16MathSupport.md
flang/docs/ReleaseNotes.md
flang/examples/ExternalHelloWorld/CMakeLists.txt
flang/lib/Optimizer/Builder/IntrinsicCall.cpp
flang/runtime/CMakeLists.txt
flang/runtime/CUDA/CMakeLists.txt
flang/runtime/Float128Math/CMakeLists.txt
flang/runtime/time-intrinsic.cpp
flang/runtime/tools.h
flang/test/CMakeLists.txt
flang/test/Driver/gcc-toolchain-install-dir.f90
flang/test/Driver/linker-flags.f90
flang/test/Driver/msvc-dependent-lib-flags.f90
flang/test/Driver/nostdlib.f90
flang/test/Runtime/no-cpp-dep.c
flang/test/lit.cfg.py
flang/tools/f18/CMakeLists.txt
flang/unittests/CMakeLists.txt
flang/unittests/Evaluate/CMakeLists.txt
flang/unittests/Runtime/CMakeLists.txt
flang/unittests/Runtime/CUDA/CMakeLists.txt
lld/COFF/MinGW.cpp
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index e0b5d003ebb13fd..61917db4d780d50 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -1321,7 +1321,7 @@ void tools::addOpenMPHostOffloadingArgs(const Compilation &C,
/// Add Fortran runtime libs
void tools::addFortranRuntimeLibs(const ToolChain &TC, const ArgList &Args,
llvm::opt::ArgStringList &CmdArgs) {
- // Link FortranRuntime
+ // Link flang_rt.runtime
// These are handled earlier on Windows by telling the frontend driver to
// add the correct libraries to link against as dependents in the object
// file.
@@ -1330,14 +1330,14 @@ void tools::addFortranRuntimeLibs(const ToolChain &TC, const ArgList &Args,
F128LibName.consume_front_insensitive("lib");
if (!F128LibName.empty()) {
bool AsNeeded = !TC.getTriple().isOSAIX();
- CmdArgs.push_back("-lFortranFloat128Math");
+ CmdArgs.push_back("-lflang_rt.quadmath");
if (AsNeeded)
addAsNeededOption(TC, Args, CmdArgs, /*as_needed=*/true);
CmdArgs.push_back(Args.MakeArgString("-l" + F128LibName));
if (AsNeeded)
addAsNeededOption(TC, Args, CmdArgs, /*as_needed=*/false);
}
- CmdArgs.push_back("-lFortranRuntime");
+ CmdArgs.push_back("-lflang_rt.runtime");
addArchSpecificRPath(TC, Args, CmdArgs);
// needs libexecinfo for backtrace functions
diff --git a/clang/lib/Driver/ToolChains/Flang.cpp b/clang/lib/Driver/ToolChains/Flang.cpp
index e7b68f4a8c60a44..591003f56e8bbb9 100644
--- a/clang/lib/Driver/ToolChains/Flang.cpp
+++ b/clang/lib/Driver/ToolChains/Flang.cpp
@@ -346,11 +346,15 @@ static void processVSRuntimeLibrary(const ToolChain &TC, const ArgList &Args,
ArgStringList &CmdArgs) {
assert(TC.getTriple().isKnownWindowsMSVCEnvironment() &&
"can only add VS runtime library on Windows!");
- // if -fno-fortran-main has been passed, skip linking Fortran_main.a
- if (TC.getTriple().isKnownWindowsMSVCEnvironment()) {
- CmdArgs.push_back(Args.MakeArgString(
- "--dependent-lib=" + TC.getCompilerRTBasename(Args, "builtins")));
- }
+
+ // Flang/Clang (including clang-cl) -compiled programs targeting the MSVC ABI
+ // should only depend on msv(u)crt. LLVM still emits libgcc/compiler-rt
+ // functions in some cases like 128-bit integer math (__udivti3, __modti3,
+ // __fixsfti, __floattidf, ...) that msvc does not support. We are injecting a
+ // dependency to Compiler-RT's builtin library where these are implemented.
+ CmdArgs.push_back(Args.MakeArgString(
+ "--dependent-lib=" + TC.getCompilerRTBasename(Args, "builtins")));
+
unsigned RTOptionID = options::OPT__SLASH_MT;
if (auto *rtl = Args.getLastArg(options::OPT_fms_runtime_lib_EQ)) {
RTOptionID = llvm::StringSwitch<unsigned>(rtl->getValue())
@@ -364,26 +368,26 @@ static void processVSRuntimeLibrary(const ToolChain &TC, const ArgList &Args,
case options::OPT__SLASH_MT:
CmdArgs.push_back("-D_MT");
CmdArgs.push_back("--dependent-lib=libcmt");
- CmdArgs.push_back("--dependent-lib=FortranRuntime.static.lib");
+ CmdArgs.push_back("--dependent-lib=flang_rt.runtime.static.lib");
break;
case options::OPT__SLASH_MTd:
CmdArgs.push_back("-D_MT");
CmdArgs.push_back("-D_DEBUG");
CmdArgs.push_back("--dependent-lib=libcmtd");
- CmdArgs.push_back("--dependent-lib=FortranRuntime.static_dbg.lib");
+ CmdArgs.push_back("--dependent-lib=flang_rt.runtime.static_dbg.lib");
break;
case options::OPT__SLASH_MD:
CmdArgs.push_back("-D_MT");
CmdArgs.push_back("-D_DLL");
CmdArgs.push_back("--dependent-lib=msvcrt");
- CmdArgs.push_back("--dependent-lib=FortranRuntime.dynamic.lib");
+ CmdArgs.push_back("--dependent-lib=flang_rt.runtime.dynamic.lib");
break;
case options::OPT__SLASH_MDd:
CmdArgs.push_back("-D_MT");
CmdArgs.push_back("-D_DEBUG");
CmdArgs.push_back("-D_DLL");
CmdArgs.push_back("--dependent-lib=msvcrtd");
- CmdArgs.push_back("--dependent-lib=FortranRuntime.dynamic_dbg.lib");
+ CmdArgs.push_back("--dependent-lib=flang_rt.runtime.dynamic_dbg.lib");
break;
}
}
diff --git a/flang/CMakeLists.txt b/flang/CMakeLists.txt
index e6de8df5cef1505..c6271f1856eb93c 100644
--- a/flang/CMakeLists.txt
+++ b/flang/CMakeLists.txt
@@ -301,7 +301,7 @@ set(FLANG_DEFAULT_LINKER "" CACHE STRING
"Default linker to use (linker name or absolute path, empty for platform default)")
set(FLANG_DEFAULT_RTLIB "" CACHE STRING
- "Default Fortran runtime library to use (\"libFortranRuntime\"), leave empty for platform default.")
+ "Default Fortran runtime library to use (\"libflang_rt.runtime\"), leave empty for platform default.")
if (NOT(FLANG_DEFAULT_RTLIB STREQUAL ""))
message(WARNING "Resetting Flang's default runtime library to use platform default.")
diff --git a/flang/cmake/modules/AddFlang.cmake b/flang/cmake/modules/AddFlang.cmake
index 1f178772067edc7..c9f65eb73fef00a 100644
--- a/flang/cmake/modules/AddFlang.cmake
+++ b/flang/cmake/modules/AddFlang.cmake
@@ -57,7 +57,7 @@ function(add_flang_library name)
set(LIBTYPE SHARED)
elseif(ARG_STATIC)
# If BUILD_SHARED_LIBS and ARG_STATIC are both set, llvm_add_library prioritizes STATIC.
- # This is required behavior for libFortranFloat128Math.
+ # This is required behavior for libflang_rt.quadmath.
set(LIBTYPE STATIC)
else()
# Let llvm_add_library decide, taking BUILD_SHARED_LIBS into account.
diff --git a/flang/docs/FlangDriver.md b/flang/docs/FlangDriver.md
index 5f960a954783dfe..97744f0bee069b1 100644
--- a/flang/docs/FlangDriver.md
+++ b/flang/docs/FlangDriver.md
@@ -175,18 +175,18 @@ like this:
```
$ flang -v -o example example.o
-"/usr/bin/ld" [...] example.o [...] "-lFortranRuntime" [...]
+"/usr/bin/ld" [...] example.o [...] "-lflang_rt.runtime" [...]
```
The automatically added libraries are:
-* `FortranRuntime`: Provides most of the Flang runtime library.
+* `flang_rt.runtime`: Provides most of the Flang runtime library.
If the code is C/C++ based and invokes Fortran routines, one can either use Clang
or Flang as the linker driver. If Clang is used, it will automatically all
required runtime libraries needed by C++ (e.g., for STL) to the linker invocation.
In this case, one has to explicitly provide the Fortran runtime library
-`FortranRuntime`. An alternative is to use Flang to link.
+`flang_rt.runtime`. An alternative is to use Flang to link.
In this case, it may be required to explicitly supply C++ runtime libraries.
On Darwin, the logical root where the system libraries are located (sysroot)
diff --git a/flang/docs/GettingStarted.md b/flang/docs/GettingStarted.md
index 1c85a6754b155b9..e422a31a0b40210 100644
--- a/flang/docs/GettingStarted.md
+++ b/flang/docs/GettingStarted.md
@@ -216,7 +216,7 @@ cmake \
-DCMAKE_CUDA_COMPILER=clang \
-DCMAKE_CUDA_HOST_COMPILER=clang++ \
../runtime/
-make -j FortranRuntime
+make -j flang-rt
```
Note that the used version of `clang` must [support](https://releases.llvm.org/16.0.0/tools/clang/docs/ReleaseNotes.html#cuda-support)
@@ -239,7 +239,7 @@ cmake \
-DCMAKE_CUDA_HOST_COMPILER=clang++ \
../runtime/
-make -j FortranRuntime
+make -j flang-rt
```
Note that `nvcc` might limit support to certain
@@ -294,7 +294,7 @@ cmake \
-DFLANG_OMP_DEVICE_ARCHITECTURES="all" \
../runtime/
-make -j FortranRuntime
+make -j flang-rt
```
The result of the build is a "device-only" library, i.e. the host
@@ -309,7 +309,7 @@ The same set of CMake variables works for Flang in-tree build.
One may provide optional CMake variables to customize the build. Available options:
* `-DFLANG_RUNTIME_F128_MATH_LIB=libquadmath`: enables build of
- `FortranFloat128Math` library that provides `REAL(16)` math APIs
+ `flang_rt.quadmath` library that provides `REAL(16)` math APIs
for intrinsics such as `SIN`, `COS`, etc. GCC `libquadmath`'s header file
`quadmath.h` must be available to the build compiler.
[More details](Real16MathSupport.md).
diff --git a/flang/docs/OpenACC-descriptor-management.md b/flang/docs/OpenACC-descriptor-management.md
index 52d00ae4daef88c..008c57937e23b89 100644
--- a/flang/docs/OpenACC-descriptor-management.md
+++ b/flang/docs/OpenACC-descriptor-management.md
@@ -427,7 +427,7 @@ The implementation's behavior may be described as (OpenACC 2.7.2):
All the "is-present" checks and the data actions for the auxiliary pointers must be performed atomically with regards to the present counters bookkeeping.
-The API relies on the primitives provided by `liboffload`, so it is provided by a new F18 runtime library, e.g. `FortranOffloadRuntime`, that depends on `FortranRuntime` and `liboffload`. The F18 driver adds `FortranOffloadRuntime` for linking under `-fopenacc`/`-fopenmp` (and maybe additional switches like `-fopenmp-targets`).
+The API relies on the primitives provided by `liboffload`, so it is provided by a new F18 runtime library, e.g. `FortranOffloadRuntime`, that depends on `flang_rt.runtime` and `liboffload`. The F18 driver adds `FortranOffloadRuntime` for linking under `-fopenacc`/`-fopenmp` (and maybe additional switches like `-fopenmp-targets`).
## TODOs:
diff --git a/flang/docs/Real16MathSupport.md b/flang/docs/Real16MathSupport.md
index 21482c7be21af6d..93492c8b767c394 100644
--- a/flang/docs/Real16MathSupport.md
+++ b/flang/docs/Real16MathSupport.md
@@ -12,9 +12,9 @@ To support most `REAL(16)` (i.e. 128-bit float) math intrinsics Flang relies
on third-party libraries providing the implementation.
`-DFLANG_RUNTIME_F128_MATH_LIB=libquadmath` CMake option can be used
-to build `FortranFloat128Math` library that has unresolved references
+to build `libflang_rt.quadmath` library that has unresolved references
to GCC `libquadmath` library. A Flang driver built with this option
-will automatically link `FortranFloat128Math` and `libquadmath` libraries
+will automatically link `libflang_rt.quadmath` and `libquadmath` libraries
to any Fortran program. This implies that `libquadmath` library
has to be available in the standard library paths, so that linker
can find it. The `libquadmath` library installation into Flang project
diff --git a/flang/docs/ReleaseNotes.md b/flang/docs/ReleaseNotes.md
index f0c956281915f4d..387d4b2e62e0fee 100644
--- a/flang/docs/ReleaseNotes.md
+++ b/flang/docs/ReleaseNotes.md
@@ -36,6 +36,13 @@ page](https://llvm.org/releases/).
## Build System Changes
+ * The FortranRuntime library has been renamed to `flang_rt.runtime`.
+
+ * The FortranFloat128Math library has been renamed to `flang_rt.quadmath`.
+
+ * The CufRuntime_cuda_${version} library has been renamed to
+ `flang_rt.cuda_${version}`.
+
## New Issues Found
diff --git a/flang/examples/ExternalHelloWorld/CMakeLists.txt b/flang/examples/ExternalHelloWorld/CMakeLists.txt
index 042d4b6238ba45c..b61948718a5e3de 100644
--- a/flang/examples/ExternalHelloWorld/CMakeLists.txt
+++ b/flang/examples/ExternalHelloWorld/CMakeLists.txt
@@ -5,5 +5,5 @@ add_llvm_example(external-hello-world
target_link_libraries(external-hello-world
PRIVATE
- FortranRuntime
+ flang_rt.runtime
)
diff --git a/flang/lib/Optimizer/Builder/IntrinsicCall.cpp b/flang/lib/Optimizer/Builder/IntrinsicCall.cpp
index 9b684520ec07820..9a80e36efe83747 100644
--- a/flang/lib/Optimizer/Builder/IntrinsicCall.cpp
+++ b/flang/lib/Optimizer/Builder/IntrinsicCall.cpp
@@ -809,8 +809,8 @@ prettyPrintIntrinsicName(fir::FirOpBuilder &builder, mlir::Location loc,
// Generate a call to the Fortran runtime library providing
// support for 128-bit float math.
// On 'HAS_LDBL128' targets the implementation
-// is provided by FortranRuntime, otherwise, it is done via
-// FortranFloat128Math library. In the latter case the compiler
+// is provided by flang_rt, otherwise, it is done via the
+// libflang_rt.quadmath library. In the latter case the compiler
// has to be built with FLANG_RUNTIME_F128_MATH_LIB to guarantee
// proper linking actions in the driver.
static mlir::Value genLibF128Call(fir::FirOpBuilder &builder,
diff --git a/flang/runtime/CMakeLists.txt b/flang/runtime/CMakeLists.txt
index 3587ec078c47fda..7cc720e2df9af8c 100644
--- a/flang/runtime/CMakeLists.txt
+++ b/flang/runtime/CMakeLists.txt
@@ -241,13 +241,13 @@ set(supported_files
utf.cpp
)
-enable_cuda_compilation(FortranRuntime "${supported_files}")
+enable_cuda_compilation(flang_rt "${supported_files}")
enable_omp_offload_compilation("${supported_files}")
-if (NOT TARGET FortranFloat128Math)
- # If FortranFloat128Math is not defined, then we are not building
- # standalone FortranFloat128Math library. Instead, include
- # the relevant sources into FortranRuntime itself.
+if (NOT TARGET flang_rt.quadmath)
+ # If flang_rt.quadmath is not defined, then we are not building
+ # standalone flang_rt.quadmath library. Instead, include
+ # the relevant sources into flang_rt.runtime itself.
# The information is provided via FortranFloat128MathILib
# interface library.
get_target_property(f128_sources
@@ -275,7 +275,7 @@ if (NOT TARGET FortranFloat128Math)
endif()
if (NOT DEFINED MSVC)
- add_flang_library(FortranRuntime
+ add_flang_library(flang_rt.runtime
${sources}
LINK_LIBS
${linked_libraries}
@@ -283,33 +283,36 @@ if (NOT DEFINED MSVC)
INSTALL_WITH_TOOLCHAIN
)
else()
- add_flang_library(FortranRuntime
+ add_flang_library(flang_rt.runtime
${sources}
LINK_LIBS
${linked_libraries}
)
set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded)
- add_flang_library(FortranRuntime.static ${sources}
+ add_flang_library(flang_rt.runtime.static ${sources}
INSTALL_WITH_TOOLCHAIN)
- set_target_properties(FortranRuntime.static PROPERTIES FOLDER "Flang/Runtime Libraries")
+ set_target_properties(flang_rt.runtime.static PROPERTIES FOLDER "Flang/Runtime Libraries")
set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreadedDLL)
- add_flang_library(FortranRuntime.dynamic ${sources}
+ add_flang_library(flang_rt.runtime.dynamic ${sources}
INSTALL_WITH_TOOLCHAIN)
- set_target_properties(FortranRuntime.dynamic PROPERTIES FOLDER "Flang/Runtime Libraries")
+ set_target_properties(flang_rt.runtime.dynamic PROPERTIES FOLDER "Flang/Runtime Libraries")
set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreadedDebug)
- add_flang_library(FortranRuntime.static_dbg ${sources}
+ add_flang_library(flang_rt.runtime.static_dbg ${sources}
INSTALL_WITH_TOOLCHAIN)
- set_target_properties(FortranRuntime.static_dbg PROPERTIES FOLDER "Flang/Runtime Libraries")
+ set_target_properties(flang_rt.runtime.static_dbg PROPERTIES FOLDER "Flang/Runtime Libraries")
set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreadedDebugDLL)
- add_flang_library(FortranRuntime.dynamic_dbg ${sources}
+ add_flang_library(flang_rt.runtime.dynamic_dbg ${sources}
INSTALL_WITH_TOOLCHAIN)
- set_target_properties(FortranRuntime.dynamic_dbg PROPERTIES FOLDER "Flang/Runtime Libraries")
- add_dependencies(FortranRuntime FortranRuntime.static FortranRuntime.dynamic
- FortranRuntime.static_dbg FortranRuntime.dynamic_dbg)
+ set_target_properties(flang_rt.runtime.dynamic_dbg PROPERTIES FOLDER "Flang/Runtime Libraries")
+ add_dependencies(flang_rt.runtime
+ flang_rt.runtime.static
+ flang_rt.runtime.dynamic
+ flang_rt.runtime.static_dbg
+ flang_rt.runtime.dynamic_dbg)
endif()
-set_target_properties(FortranRuntime PROPERTIES FOLDER "Flang/Runtime Libraries")
+set_target_properties(flang_rt.runtime PROPERTIES FOLDER "Flang/Runtime Libraries")
-# If FortranRuntime is part of a Flang build (and not a separate build) then
+# If flang_rt is part of a Flang build (and not a separate build) then
# add dependency to make sure that Fortran runtime library is being built after
# we have the Flang compiler available. This also includes the MODULE files
# that compile when the 'flang' target is built.
@@ -317,9 +320,21 @@ set_target_properties(FortranRuntime PROPERTIES FOLDER "Flang/Runtime Libraries"
# TODO: This is a workaround and should be updated when runtime build procedure
# is changed to a regular runtime build. See discussion in PR #95388.
if (TARGET flang AND TARGET module_files)
- add_dependencies(FortranRuntime flang module_files)
+ add_dependencies(flang_rt.runtime flang module_files)
endif()
if (FLANG_CUF_RUNTIME)
add_subdirectory(CUDA)
endif()
+
+# Compatibility targets.
+add_custom_target(flang-rt)
+add_dependencies(flang-rt flang_rt.runtime)
+if (TARGET flang_rt.quadmath)
+ add_dependencies(flang-rt flang_rt.quadmath)
+endif ()
+if (TARGET flang_rt.cuda_${CUDAToolkit_VERSION_MAJOR})
+ add_dependencies(flang-rt flang_rt.cuda_${CUDAToolkit_VERSION_MAJOR})
+endif ()
+add_custom_target(FortranRuntime)
+add_dependencies(FortranRuntime flang_rt.runtime)
diff --git a/flang/runtime/CUDA/CMakeLists.txt b/flang/runtime/CUDA/CMakeLists.txt
index bfbae58086c1fd0..1fd3bf22a83cf81 100644
--- a/flang/runtime/CUDA/CMakeLists.txt
+++ b/flang/runtime/CUDA/CMakeLists.txt
@@ -8,10 +8,10 @@
include_directories(${CUDAToolkit_INCLUDE_DIRS})
-# libCufRuntime depends on a certain version of CUDA. To be able to have
+# libflang_rt.cuda depends on a certain version of CUDA. To be able to have
# multiple build of this library with
diff erent CUDA version, the version is
# added to the library name.
-set(CUFRT_LIBNAME CufRuntime_cuda_${CUDAToolkit_VERSION_MAJOR})
+set(CUFRT_LIBNAME flang_rt.cuda_${CUDAToolkit_VERSION_MAJOR})
add_flang_library(${CUFRT_LIBNAME}
allocator.cpp
@@ -33,6 +33,6 @@ endif()
target_link_libraries(${CUFRT_LIBNAME}
PRIVATE
- FortranRuntime
+ flang_rt.runtime
${CUDA_RT_TARGET}
)
diff --git a/flang/runtime/Float128Math/CMakeLists.txt b/flang/runtime/Float128Math/CMakeLists.txt
index 703f85fcaf8dacb..3c382d16a21cdaf 100644
--- a/flang/runtime/Float128Math/CMakeLists.txt
+++ b/flang/runtime/Float128Math/CMakeLists.txt
@@ -12,7 +12,7 @@
# It is distributed as a static library only.
# Fortran programs/libraries that end up linking any of the provided
# will have a dependency on the third-party library that is being
-# used for building this FortranFloat128Math library.
+# used for building this flang_rt.quadmath library.
include(CheckLibraryExists)
@@ -93,20 +93,20 @@ if (FLANG_RUNTIME_F128_MATH_LIB)
)
endif()
- add_flang_library(FortranFloat128Math STATIC INSTALL_WITH_TOOLCHAIN
+ add_flang_library(flang_rt.quadmath STATIC INSTALL_WITH_TOOLCHAIN
${sources})
if (DEFINED MSVC)
set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded)
- add_flang_library(FortranFloat128Math.static STATIC INSTALL_WITH_TOOLCHAIN
+ add_flang_library(flang_rt.quadmath.static STATIC INSTALL_WITH_TOOLCHAIN
${sources}
)
set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreadedDebug)
- add_flang_library(FortranFloat128Math.static_dbg STATIC INSTALL_WITH_TOOLCHAIN
+ add_flang_library(flang_rt.quadmath.static_dbg STATIC INSTALL_WITH_TOOLCHAIN
${sources}
)
- add_dependencies(FortranFloat128Math FortranFloat128Math.static
- FortranFloat128Math.static_dbg
+ add_dependencies(flang_rt.quadmath flang_rt.quadmath.static
+ flang_rt.quadmath.static_dbg
)
endif()
elseif (HAVE_LDBL_MANT_DIG_113)
@@ -118,7 +118,7 @@ elseif (HAVE_LDBL_MANT_DIG_113)
)
target_sources(FortranFloat128MathILib INTERFACE ${sources})
else()
- message(FATAL_ERROR "FortranRuntime cannot build without libm")
+ message(FATAL_ERROR "flang_rt.quadmath cannot build without libm")
endif()
else()
# We can use '__float128' version from libc, if it has them.
diff --git a/flang/runtime/time-intrinsic.cpp b/flang/runtime/time-intrinsic.cpp
index e6f6e81c7b50cca..942604a92aaad79 100644
--- a/flang/runtime/time-intrinsic.cpp
+++ b/flang/runtime/time-intrinsic.cpp
@@ -62,7 +62,7 @@ template <typename Unused = void> double GetCpuTime(fallback_implementation) {
#if defined __MINGW32__
// clock_gettime is implemented in the pthread library for MinGW.
-// Using it here would mean that all programs that link libFortranRuntime are
+// Using it here would mean that all programs that link libflang_rt are
// required to also link to pthread. Instead, don't use the function.
#undef CLOCKID_CPU_TIME
#undef CLOCKID_ELAPSED_TIME
diff --git a/flang/runtime/tools.h b/flang/runtime/tools.h
index facbd2316105700..75544098d47ab27 100644
--- a/flang/runtime/tools.h
+++ b/flang/runtime/tools.h
@@ -348,7 +348,7 @@ inline RT_API_ATTRS RESULT ApplyFloatingPointKind(
if constexpr (HasCppTypeFor<TypeCategory::Real, 16>) {
// If FUNC implemenation relies on FP math functions,
// then we should not be here. The compiler should have
- // generated a call to an entry in FortranFloat128Math
+ // generated a call to an entry in flang_rt.quadmath
// library.
if constexpr (!NEEDSMATH) {
return FUNC<16>{}(std::forward<A>(x)...);
diff --git a/flang/test/CMakeLists.txt b/flang/test/CMakeLists.txt
index e398e0786147aa7..3fac8717e9bd9da 100644
--- a/flang/test/CMakeLists.txt
+++ b/flang/test/CMakeLists.txt
@@ -75,7 +75,7 @@ set(FLANG_TEST_DEPENDS
)
if (FLANG_INCLUDE_RUNTIME)
- list(APPEND FLANG_TEST_DEPENDS FortranRuntime)
+ list(APPEND FLANG_TEST_DEPENDS flang_rt.runtime)
endif ()
if (LLVM_ENABLE_PLUGINS AND NOT WIN32)
@@ -124,3 +124,9 @@ if (DEFINED FLANG_TEST_TARGET_TRIPLE)
"to use FLANG_TEST_TARGET_TRIPLE.")
endif()
endif()
+
+# Compatibility targets.
+if (FLANG_INCLUDE_RUNTIME)
+ add_custom_target(check-flang-rt)
+ add_dependencies(check-flang-rt check-flang)
+endif ()
diff --git a/flang/test/Driver/gcc-toolchain-install-dir.f90 b/flang/test/Driver/gcc-toolchain-install-dir.f90
index 5a073b0c517122a..e195bdde6d2c93a 100644
--- a/flang/test/Driver/gcc-toolchain-install-dir.f90
+++ b/flang/test/Driver/gcc-toolchain-install-dir.f90
@@ -1,5 +1,5 @@
!! Test that --gcc-toolchain and --gcc-install-dir options are working as expected.
-!! It does not test cross-compiling (--sysroot), so crtbegin.o, libgcc/compiler-rt, libc, libFortranRuntime, etc. are not supposed to be affected.
+!! It does not test cross-compiling (--sysroot), so crtbegin.o, libgcc/compiler-rt, libc, libflang_rt.runtime, etc. are not supposed to be affected.
!! PREFIX is captured twice because the driver escapes backslashes (occuring in Windows paths) in the -### output, but not on the "Selected GCC installation:" line.
! RUN: %flang 2>&1 -### -v -o %t %s -no-integrated-as -fuse-ld=ld --target=i386-unknown-linux-gnu --gcc-install-dir=%S/Inputs/basic_cross_linux_tree/usr/lib/gcc/i386-unknown-linux-gnu/10.2.0 | FileCheck %s --check-prefix=CHECK-I386
diff --git a/flang/test/Driver/linker-flags.f90 b/flang/test/Driver/linker-flags.f90
index 16bd4c3ba837113..4e62a8c32d36083 100644
--- a/flang/test/Driver/linker-flags.f90
+++ b/flang/test/Driver/linker-flags.f90
@@ -29,37 +29,37 @@
! executable and may find the GNU linker from MinGW or Cygwin.
! UNIX-LABEL: "{{.*}}ld{{(\.exe)?}}"
! UNIX-SAME: "[[object_file]]"
-! UNIX-F128NONE-NOT: FortranFloat128Math
-! SOLARIS-F128NONE-NOT: FortranFloat128Math
-! UNIX-F128LIBQUADMATH-SAME: "-lFortranFloat128Math" "--as-needed" "-lquadmath" "--no-as-needed"
-! SOLARIS-F128LIBQUADMATH-SAME: "-lFortranFloat128Math" "-z" "ignore" "-lquadmath" "-z" "record"
-! UNIX-SAME: "-lFortranRuntime" "-lm"
+! UNIX-F128NONE-NOT: lang_rt.quadmath
+! SOLARIS-F128NONE-NOT: flang_rt.quadmath
+! UNIX-F128LIBQUADMATH-SAME: "-lflang_rt.quadmath" "--as-needed" "-lquadmath" "--no-as-needed"
+! SOLARIS-F128LIBQUADMATH-SAME: "-lflang_rt.quadmath" "-z" "ignore" "-lquadmath" "-z" "record"
+! UNIX-SAME: "-lflang_rt.runtime" "-lm"
! COMPILER-RT: "{{.*}}{{\\|/}}libclang_rt.builtins.a"
! BSD-LABEL: "{{.*}}ld{{(\.exe)?}}"
! BSD-SAME: "[[object_file]]"
-! BSD-F128NONE-NOT: FortranFloat128Math
-! BSD-F128LIBQUADMATH-SAME: "-lFortranFloat128Math" "--as-needed" "-lquadmath" "--no-as-needed"
-! BSD-SAME: -lFortranRuntime
+! BSD-F128NONE-NOT: flang_rt.quadmath
+! BSD-F128LIBQUADMATH-SAME: "-lflang_rt.quadmath" "--as-needed" "-lquadmath" "--no-as-needed"
+! BSD-SAME: -lflang_rt.runtime
! BSD-SAME: -lexecinfo
! DARWIN-LABEL: "{{.*}}ld{{(\.exe)?}}"
! DARWIN-SAME: "[[object_file]]"
-! DARWIN-F128NONE-NOT: FortranFloat128Math
-! DARWIN-F128LIBQUADMATH-SAME: "-lFortranFloat128Math" "--as-needed" "-lquadmath" "--no-as-needed"
-! DARWIN-SAME: -lFortranRuntime
+! DARWIN-F128NONE-NOT: libflang_rt.quadmath
+! DARWIN-F128LIBQUADMATH-SAME: "-lflang_rt.quadmath" "--as-needed" "-lquadmath" "--no-as-needed"
+! DARWIN-SAME: -lflang_rt.runtime
! HAIKU-LABEL: "{{.*}}ld{{(\.exe)?}}"
! HAIKU-SAME: "[[object_file]]"
-! HAIKU-F128NONE-NOT: FortranFloat128Math
-! HAIKU-F128LIBQUADMATH-SAME: "-lFortranFloat128Math" "--as-needed" "-lquadmath" "--no-as-needed"
-! HAIKU-SAME: "-lFortranRuntime"
+! HAIKU-F128NONE-NOT: libflang_rt.quadmath
+! HAIKU-F128LIBQUADMATH-SAME: "-lflang_rt.quadmath" "--as-needed" "-lquadmath" "--no-as-needed"
+! HAIKU-SAME: "-lflang_rt.runtime"
! MINGW-LABEL: "{{.*}}ld{{(\.exe)?}}"
! MINGW-SAME: "[[object_file]]"
-! MINGW-F128NONE-NOT: FortranFloat128Math
-! MINGW-F128LIBQUADMATH-SAME: "-lFortranFloat128Math" "--as-needed" "-lquadmath" "--no-as-needed"
-! MINGW-SAME: -lFortranRuntime
+! MINGW-F128NONE-NOT: libflang_rt.quadmath
+! MINGW-F128LIBQUADMATH-SAME: "-lflang_rt.quadmath" "--as-needed" "-lquadmath" "--no-as-needed"
+! MINGW-SAME: -lflang_rt.runtime
! NOTE: This also matches lld-link (when CLANG_DEFAULT_LINKER=lld) and
! any .exe suffix that is added when resolving to the full path of
diff --git a/flang/test/Driver/msvc-dependent-lib-flags.f90 b/flang/test/Driver/msvc-dependent-lib-flags.f90
index befe61fdadcd141..641c73912c4d1e5 100644
--- a/flang/test/Driver/msvc-dependent-lib-flags.f90
+++ b/flang/test/Driver/msvc-dependent-lib-flags.f90
@@ -7,21 +7,21 @@
! MSVC-SAME: --dependent-lib=clang_rt.builtins.lib
! MSVC-SAME: -D_MT
! MSVC-SAME: --dependent-lib=libcmt
-! MSVC-SAME: --dependent-lib=FortranRuntime.static.lib
+! MSVC-SAME: --dependent-lib=flang_rt.runtime.static.lib
! MSVC-DEBUG: -fc1
! MSVC-DEBUG-SAME: --dependent-lib=clang_rt.builtins.lib
! MSVC-DEBUG-SAME: -D_MT
! MSVC-DEBUG-SAME: -D_DEBUG
! MSVC-DEBUG-SAME: --dependent-lib=libcmtd
-! MSVC-DEBUG-SAME: --dependent-lib=FortranRuntime.static_dbg.lib
+! MSVC-DEBUG-SAME: --dependent-lib=flang_rt.runtime.static_dbg.lib
! MSVC-DLL: -fc1
! MSVC-DLL-SAME: --dependent-lib=clang_rt.builtins.lib
! MSVC-DLL-SAME: -D_MT
! MSVC-DLL-SAME: -D_DLL
! MSVC-DLL-SAME: --dependent-lib=msvcrt
-! MSVC-DLL-SAME: --dependent-lib=FortranRuntime.dynamic.lib
+! MSVC-DLL-SAME: --dependent-lib=flang_rt.runtime.dynamic.lib
! MSVC-DLL-DEBUG: -fc1
! MSVC-DLL-DEBUG-SAME: --dependent-lib=clang_rt.builtins.lib
@@ -29,4 +29,4 @@
! MSVC-DLL-DEBUG-SAME: -D_DEBUG
! MSVC-DLL-DEBUG-SAME: -D_DLL
! MSVC-DLL-DEBUG-SAME: --dependent-lib=msvcrtd
-! MSVC-DLL-DEBUG-SAME: --dependent-lib=FortranRuntime.dynamic_dbg.lib
+! MSVC-DLL-DEBUG-SAME: --dependent-lib=flang_rt.runtime.dynamic_dbg.lib
diff --git a/flang/test/Driver/nostdlib.f90 b/flang/test/Driver/nostdlib.f90
index ab7c675fe7b77d5..dc23be646237697 100644
--- a/flang/test/Driver/nostdlib.f90
+++ b/flang/test/Driver/nostdlib.f90
@@ -24,5 +24,5 @@
! in certain cases. But it is not clear that it is worth checking for each
! platform individually.
-! CHECK-NOT: "-lFortranRuntime"
+! CHECK-NOT: "-lflang_rt.runtime"
! CHECK-NOT: "-lgcc"
diff --git a/flang/test/Runtime/no-cpp-dep.c b/flang/test/Runtime/no-cpp-dep.c
index 7303ce63fdec410..4fcf8f9d478d8c1 100644
--- a/flang/test/Runtime/no-cpp-dep.c
+++ b/flang/test/Runtime/no-cpp-dep.c
@@ -1,6 +1,6 @@
/*
This test makes sure that flang's runtime does not depend on the C++ runtime
-library. It tries to link this simple file against libFortranRuntime.a with
+library. It tries to link this simple file against libflang_rt.runtime.a with
a C compiler.
REQUIRES: c-compiler, flang-rt
diff --git a/flang/test/lit.cfg.py b/flang/test/lit.cfg.py
index f4580afc8c47b12..c6266f3976f7c56 100644
--- a/flang/test/lit.cfg.py
+++ b/flang/test/lit.cfg.py
@@ -170,7 +170,7 @@
# the C++ runtime libraries. For this we need a C compiler. If for some reason
# we don't have one, we can just disable the test.
if config.flang_include_runtime and config.cc:
- libruntime = os.path.join(config.flang_lib_dir, "libFortranRuntime.a")
+ libruntime = os.path.join(config.flang_lib_dir, "libflang_rt.runtime.a")
include = os.path.join(config.flang_src_dir, "include")
if (
diff --git a/flang/tools/f18/CMakeLists.txt b/flang/tools/f18/CMakeLists.txt
index 85ba2c74cdeb5c4..5b5f23b5dc73c2e 100644
--- a/flang/tools/f18/CMakeLists.txt
+++ b/flang/tools/f18/CMakeLists.txt
@@ -5,7 +5,7 @@ set(LLVM_LINK_COMPONENTS
)
# Define the list of Fortran module files that need to be compiled
-# to produce an object file for inclusion into the FortranRuntime
+# to produce an object file for inclusion into the flang_rt.runtime
# library.
set(MODULES_WITH_IMPLEMENTATION
"iso_fortran_env_impl"
@@ -105,7 +105,7 @@ if (NOT CMAKE_CROSSCOMPILING)
endif()
# Some modules have an implementation part that needs to be added to the
- # FortranRuntime library.
+ # flang_rt.runtime library.
set(compile_with "-fsyntax-only")
set(object_output "")
set(include_in_link FALSE)
@@ -127,14 +127,14 @@ if (NOT CMAKE_CROSSCOMPILING)
install(FILES ${base}.mod DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/flang")
# If a module has been compiled into an object file, add the file to
- # the link line for the FortranRuntime library.
+ # the link line for the flang_rt.runtime library.
if(include_in_link)
list(APPEND module_objects ${object_output})
endif()
endforeach()
# Set a CACHE variable that is visible to the CMakeLists.txt in runtime/, so that
- # the compiled Fortran modules can be added to the link line of the FortranRuntime
+ # the compiled Fortran modules can be added to the link line of the flang_rt.runtime
# library.
set(FORTRAN_MODULE_OBJECTS ${module_objects} CACHE INTERNAL "" FORCE)
diff --git a/flang/unittests/CMakeLists.txt b/flang/unittests/CMakeLists.txt
index ecb7d68d8f72966..c54ceb3332abf80 100644
--- a/flang/unittests/CMakeLists.txt
+++ b/flang/unittests/CMakeLists.txt
@@ -2,7 +2,7 @@ include(AddFlangOffloadRuntime)
if (FLANG_EXPERIMENTAL_CUDA_RUNTIME)
# If Fortran runtime is built as CUDA library, the linking
- # of targets that link FortranRuntime must be done
+ # of targets that link flang_rt.runtime must be done
# with CUDA_RESOLVE_DEVICE_SYMBOLS.
# CUDA language must be enabled for CUDA_RESOLVE_DEVICE_SYMBOLS
# to take effect.
diff --git a/flang/unittests/Evaluate/CMakeLists.txt b/flang/unittests/Evaluate/CMakeLists.txt
index 1c3fac29cd2982e..2278d61febcb11d 100644
--- a/flang/unittests/Evaluate/CMakeLists.txt
+++ b/flang/unittests/Evaluate/CMakeLists.txt
@@ -60,14 +60,14 @@ if (FLANG_INCLUDE_RUNTIME)
NonGTestTesting
FortranSemantics
FortranEvaluate
- FortranRuntime
+ flang_rt.runtime
)
add_flang_nongtest_unittest(ISO-Fortran-binding
NonGTestTesting
FortranEvaluate
FortranSemantics
- FortranRuntime
+ flang_rt.runtime
)
endif ()
diff --git a/flang/unittests/Runtime/CMakeLists.txt b/flang/unittests/Runtime/CMakeLists.txt
index 179e439917ff237..f3743be49b01549 100644
--- a/flang/unittests/Runtime/CMakeLists.txt
+++ b/flang/unittests/Runtime/CMakeLists.txt
@@ -33,7 +33,7 @@ add_flang_unittest(FlangRuntimeTests
target_link_libraries(FlangRuntimeTests
PRIVATE
- FortranRuntime
+ flang_rt.runtime
)
target_compile_definitions(FlangRuntimeTests PRIVATE NOT_EXE="$<TARGET_FILE:not>")
diff --git a/flang/unittests/Runtime/CUDA/CMakeLists.txt b/flang/unittests/Runtime/CUDA/CMakeLists.txt
index a7fe604d687bdd8..860b2664d623b99 100644
--- a/flang/unittests/Runtime/CUDA/CMakeLists.txt
+++ b/flang/unittests/Runtime/CUDA/CMakeLists.txt
@@ -15,8 +15,8 @@ endif()
target_link_libraries(FlangCufRuntimeTests
PRIVATE
${CUDA_RT_TARGET}
- CufRuntime_cuda_${CUDAToolkit_VERSION_MAJOR}
- FortranRuntime
+ flang_rt.cuda_${CUDAToolkit_VERSION_MAJOR}
+ flang_rt.runtime
)
target_include_directories(FlangCufRuntimeTests PRIVATE ${CUDAToolkit_INCLUDE_DIRS})
diff --git a/lld/COFF/MinGW.cpp b/lld/COFF/MinGW.cpp
index 0786353b06432a0..62db04cbe507ead 100644
--- a/lld/COFF/MinGW.cpp
+++ b/lld/COFF/MinGW.cpp
@@ -49,7 +49,7 @@ AutoExporter::AutoExporter(
"libclang_rt.profile-x86_64",
"libc++",
"libc++abi",
- "libFortranRuntime",
+ "libflang_rt.runtime",
"libunwind",
"libmsvcrt",
"libucrtbase",
More information about the cfe-commits
mailing list