Skip to content

Commit f97c774

Browse files
committed
build fixes
1 parent c86aa90 commit f97c774

File tree

21 files changed

+113
-109
lines changed

21 files changed

+113
-109
lines changed

clang/lib/Driver/ToolChains/CommonArgs.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1330,7 +1330,7 @@ void tools::addFortranRuntimeLibs(const ToolChain &TC, const ArgList &Args,
13301330
F128LibName.consume_front_insensitive("lib");
13311331
if (!F128LibName.empty()) {
13321332
bool AsNeeded = !TC.getTriple().isOSAIX();
1333-
CmdArgs.push_back("-lFortranFloat128Math");
1333+
CmdArgs.push_back("-lflang_rt.quadmath");
13341334
if (AsNeeded)
13351335
addAsNeededOption(TC, Args, CmdArgs, /*as_needed=*/true);
13361336
CmdArgs.push_back(Args.MakeArgString("-l" + F128LibName));

flang-rt/cmake/modules/AddFlangRT.cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#
77
#===------------------------------------------------------------------------===#
88

9-
# Builds a library with common options for flang-rt.
9+
# Builds a library with common options for Flang-RT.
1010
#
1111
# Usage:
1212
#
@@ -108,11 +108,11 @@ function (add_flangrt_library name)
108108
endif ()
109109

110110
# Flang-RT's public headers
111-
target_include_directories(${name} PRIVATE "${FLANG_RT_SOURCE_DIR}/include")
111+
target_include_directories(${name} PUBLIC "${FLANG_RT_SOURCE_DIR}/include")
112112

113113
# For ISO_Fortran_binding.h to be found by the runtime itself (Accessed as #include "flang/ISO_Fortran_binding.h")
114114
# User applications can use #include <ISO_Fortran_binding.h>
115-
target_include_directories(${name} PRIVATE "${FLANG_SOURCE_DIR}/include")
115+
target_include_directories(${name} PUBLIC "${FLANG_SOURCE_DIR}/include")
116116

117117
# For Flang-RT's configured config.h to be found
118118
target_include_directories(${name} PRIVATE "${FLANG_RT_BINARY_DIR}")

flang-rt/cmake/modules/AddFlangRTOffload.cmake

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ macro(enable_cuda_compilation name files)
3434
)
3535
endif()
3636
set_source_files_properties(${files} PROPERTIES COMPILE_OPTIONS
37-
"${CUDA_COMPILE_OPTIONS}"
38-
)
37+
"${CUDA_COMPILE_OPTIONS}")
3938

4039
# Create a .a library consisting of CUDA PTX.
4140
# This is different from a regular static library. The CUDA_PTX_COMPILATION

flang-rt/examples/ExternalHelloWorld/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ add_llvm_example(external-hello-world
1313

1414
target_link_libraries(external-hello-world
1515
PRIVATE
16-
flang_rt.runtime
16+
flang_rt.runtime
1717
)

flang-rt/include/flang-rt/runtime/tools.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ inline RT_API_ATTRS RESULT ApplyFloatingPointKind(
348348
if constexpr (HasCppTypeFor<TypeCategory::Real, 16>) {
349349
// If FUNC implemenation relies on FP math functions,
350350
// then we should not be here. The compiler should have
351-
// generated a call to an entry in FortranFloat128Math
351+
// generated a call to an entry in the libflang_rt.quadmath
352352
// library.
353353
if constexpr (!NEEDSMATH) {
354354
return FUNC<16>{}(std::forward<A>(x)...);

flang-rt/lib/quadmath/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# It is distributed as a static library only.
1313
# Fortran programs/libraries that end up linking any of the provided
1414
# will have a dependency on the third-party library that is being
15-
# used for building this FortranFloat128Math library.
15+
# used for building this libflang_rt.quadmath library.
1616

1717
include(CheckLibraryExists)
1818
include(CheckIncludeFile)
@@ -95,7 +95,7 @@ if (FLANG_RUNTIME_F128_MATH_LIB)
9595
endif()
9696

9797
if (WIN32)
98-
# Do not create a FortranFloat128Math library under Windows, the Flang
98+
# Do not create a flang_rt.quadmath library under Windows, the Flang
9999
# driver never links it. Instead, add the sources to flang_rt.runtime.
100100
target_sources(FortranFloat128MathILib INTERFACE ${sources})
101101
target_compile_definitions(FortranFloat128MathILib INTERFACE HAS_QUADMATHLIB)

flang-rt/lib/quadmath/complex-math.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*===-- lib/FortranFloat128Math/complex-math.c ----------------------*- C -*-===
1+
/*===-- lib/quadmath/complex-math.c ---------------------------------*- C -*-===
22
*
33
* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
* See https://llvm.org/LICENSE.txt for license information.

flang-rt/lib/quadmath/complex-math.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,4 @@
5959
#error "Float128Math build with glibc>=2.26 is unsupported yet"
6060
#endif
6161

62-
#endif // FLANG_RT_QUADMATH_COMPLEX_MATH_H_
62+
#endif /* FLANG_RT_QUADMATH_COMPLEX_MATH_H_ */

flang-rt/lib/runtime/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ file(GLOB_RECURSE private_headers
9999
)
100100

101101

102-
# Import changes from sibling FortranFloat128Math
102+
# Import changes from flang_rt.quadmath
103103
get_target_property(f128_sources
104104
FortranFloat128MathILib INTERFACE_SOURCES
105105
)
@@ -170,7 +170,7 @@ else()
170170

171171
enable_cuda_compilation(${name} "${supported_sources}")
172172
enable_omp_offload_compilation(${name} "${supported_sources}")
173-
add_dependencies(flang_rt ${name})
173+
add_dependencies(flang_rt.runtime ${name})
174174
endfunction ()
175175

176176
# Variants of the static flang_rt for different versions of the msvc runtime.

flang-rt/test/Runtime/no-cpp-dep.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
/*
22
This test makes sure that flang's runtime does not depend on the C++ runtime
3-
library. It tries to link this simple file against libflang_rt.a with
3+
library. It tries to link this simple file against libflang_rt.runtime.a with
44
a C compiler.
55
66
UNSUPPORTED: system-windows
77
UNSUPPORTED: offload-cuda
88
99
RUN: %if system-aix %{ export OBJECT_MODE=64 %}
10-
RUN: %cc -std=c99 %s -I%include -L"%libdir" -lflang_rt -lm \
10+
RUN: %cc -std=c99 %s -I%include -L"%libdir" -lflang_rt.runtime -lm \
1111
RUN: %if system-aix %{-lpthread %}
1212
RUN: rm a.out
1313
*/

flang-rt/unittests/CMakeLists.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ function(add_flangrt_unittest test_dirname)
6464

6565
add_unittest(FlangRTUnitTests ${test_dirname} ${ARG_UNPARSED_ARGUMENTS})
6666

67-
target_include_directories(${test_dirname} PRIVATE "${FLANG_RT_SOURCE_DIR}/include")
68-
target_include_directories(${test_dirname} PRIVATE "${FLANG_SOURCE_DIR}/include")
6967
target_link_libraries(${test_dirname} PRIVATE ${ARG_LINK_LIBS})
7068
add_flangrt_unittest_offload_properties(${test_dirname})
7169

@@ -94,10 +92,6 @@ function(add_flangrt_nongtest_unittest test_name)
9492
add_executable(${test_name}${suffix} EXCLUDE_FROM_ALL ${ARG_UNPARSED_ARGUMENTS})
9593
set_target_properties(${test_name}${suffix} PROPERTIES FOLDER "Flang-RT/Tests/Unit")
9694

97-
target_include_directories(${test_name}${suffix} PRIVATE
98-
"${FLANG_RT_SOURCE_DIR}/include"
99-
"${FLANG_SOURCE_DIR}/include"
100-
)
10195
target_link_libraries(${test_name}${suffix} PRIVATE NonGTestTesting ${ARG_LINK_LIBS})
10296

10397
if(NOT ARG_SLOW_TEST)

flang-rt/unittests/Evaluate/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ add_flangrt_nongtest_unittest(reshape
1010
reshape.cpp
1111

1212
LINK_LIBS
13-
flang_rt.unittest
13+
flang_rt.runtime.unittest
1414
)
1515

1616
add_flangrt_nongtest_unittest(ISO-Fortran-binding
1717
ISO-Fortran-binding.cpp
1818

1919
LINK_LIBS
20-
flang_rt.unittest
20+
flang_rt.runtime.unittest
2121
)

flang-rt/unittests/Runtime/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ add_flangrt_unittest(RuntimeTests
3939
Transformational.cpp
4040

4141
LINK_LIBS
42-
flang_rt.unittest
42+
flang_rt.runtime.unittest
4343
)
4444
target_compile_definitions(RuntimeTests PRIVATE NOT_EXE="${LLVM_TOOLS_DIR}/not${CMAKE_EXECUTABLE_SUFFIX}")
4545

flang/cmake/modules/AddFlang.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function(add_flang_library name)
5757
set(LIBTYPE SHARED)
5858
elseif(ARG_STATIC)
5959
# If BUILD_SHARED_LIBS and ARG_STATIC are both set, llvm_add_library prioritizes STATIC.
60-
# This is required behavior for libFortranFloat128Math.
60+
# This is required behavior for libflang_rt.quadmath.
6161
set(LIBTYPE STATIC)
6262
else()
6363
# Let llvm_add_library decide, taking BUILD_SHARED_LIBS into account.

flang/docs/GettingStarted.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ The same set of CMake variables works for Flang in-tree build.
317317
One may provide optional CMake variables to customize the build. Available options:
318318

319319
* `-DFLANG_RUNTIME_F128_MATH_LIB=libquadmath`: enables build of
320-
`FortranFloat128Math` library that provides `REAL(16)` math APIs
320+
`flang_rt.quadmath` library that provides `REAL(16)` math APIs
321321
for intrinsics such as `SIN`, `COS`, etc. GCC `libquadmath`'s header file
322322
`quadmath.h` must be available to the build compiler.
323323
[More details](Real16MathSupport.md).

flang/docs/Real16MathSupport.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ To support most `REAL(16)` (i.e. 128-bit float) math intrinsics Flang relies
1212
on third-party libraries providing the implementation.
1313

1414
`-DFLANG_RUNTIME_F128_MATH_LIB=libquadmath` CMake option can be used
15-
to build `FortranFloat128Math` library that has unresolved references
15+
to build `libflang_rt.quadmath` library that has unresolved references
1616
to GCC `libquadmath` library. A Flang driver built with this option
17-
will automatically link `FortranFloat128Math` and `libquadmath` libraries
17+
will automatically link `libflang_rt.quadmath` and `libquadmath` libraries
1818
to any Fortran program. This implies that `libquadmath` library
1919
has to be available in the standard library paths, so that linker
2020
can find it. The `libquadmath` library installation into Flang project

flang/docs/ReleaseNotes.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,18 @@ page](https://llvm.org/releases/).
3636

3737
## Build System Changes
3838

39+
* The FortranRuntime library has been renamed to `flang_rt.runtime`.
40+
41+
* The FortranFloat128Math library has been renamed to `flang_rt.quadmath`.
42+
43+
* The CufRuntime_cuda_${version} library has been renamed to
44+
`flang_rt.cuda_${version}`.
45+
3946
* The Fortran Runtime library has been move to a new top-level directory
40-
named "flang-rt". The library was also renamed from `FortranRuntime` to
41-
`flang_rt.runtime`. It now supports the
42-
LLVM_ENABLE_RUNTIMES mechanism to build Flang-RT for multiple target
43-
triples. libflang_rt.runtime.a will now be emitted into Clang's per-target
44-
resource directory (next to libclang_rt.*.*) where it is also found by
45-
Flang's driver.
47+
named "flang-rt". It now supports the LLVM_ENABLE_RUNTIMES mechanism to
48+
build Flang-RT for multiple target triples. libflang_rt.runtime.{a|so} will
49+
now be emitted into Clang's per-target resource directory
50+
(next to libclang_rt.*.*) where it is also found by Flang's driver.
4651

4752
## New Issues Found
4853

flang/lib/Optimizer/Builder/IntrinsicCall.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -808,8 +808,8 @@ prettyPrintIntrinsicName(fir::FirOpBuilder &builder, mlir::Location loc,
808808
// Generate a call to the Fortran runtime library providing
809809
// support for 128-bit float math.
810810
// On 'HAS_LDBL128' targets the implementation
811-
// is provided by flang_rt, otherwise, it is done via
812-
// FortranFloat128Math library. In the latter case the compiler
811+
// is provided by flang_rt, otherwise, it is done via the
812+
// libflang_rt.quadmath library. In the latter case the compiler
813813
// has to be built with FLANG_RUNTIME_F128_MATH_LIB to guarantee
814814
// proper linking actions in the driver.
815815
static mlir::Value genLibF128Call(fir::FirOpBuilder &builder,

flang/runtime/CMakeLists.txt

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -259,14 +259,14 @@ set(supported_files
259259
unit.cpp
260260
utf.cpp
261261
)
262-
263262
runtime_source_files(supported_files SUBDIR "runtime")
263+
264264
enable_cuda_compilation(flang_rt "${supported_files}")
265265
enable_omp_offload_compilation("${supported_files}")
266266

267-
if (NOT TARGET FortranFloat128Math)
268-
# If FortranFloat128Math is not defined, then we are not building
269-
# standalone FortranFloat128Math library. Instead, include
267+
if (NOT TARGET flang_rt.quadmath)
268+
# If flang_rt.quadmath is not defined, then we are not building
269+
# standalone flang_rt.quadmath library. Instead, include
270270
# the relevant sources into flang_rt itself.
271271
# The information is provided via FortranFloat128MathILib
272272
# interface library.
@@ -293,7 +293,6 @@ if (NOT TARGET FortranFloat128Math)
293293
list(APPEND sources ${f128_sources})
294294
endif()
295295
endif()
296-
297296
runtime_source_files(sources SUBDIR "runtime")
298297

299298

@@ -349,5 +348,11 @@ endif()
349348
# Compatibility targets.
350349
add_custom_target(flang-rt)
351350
add_dependencies(flang-rt flang_rt.runtime)
351+
if (TARGET flang_rt.quadmath)
352+
add_dependencies(flang-rt flang_rt.quadmath)
353+
endif ()
354+
if (TARGET flang_rt.cuda_${CUDAToolkit_VERSION_MAJOR})
355+
add_dependencies(flang-rt flang_rt.cuda_${CUDAToolkit_VERSION_MAJOR})
356+
endif ()
352357
add_custom_target(FortranRuntime)
353358
add_dependencies(FortranRuntime flang_rt.runtime)

0 commit comments

Comments
 (0)