Skip to content

Commit ed062e4

Browse files
committed
Merge branch 'users/meinersbur/flang_runtime_move-files' into users/meinersbur/flang_runtime
2 parents e0e7297 + 5b8c8ec commit ed062e4

File tree

16 files changed

+122
-55
lines changed

16 files changed

+122
-55
lines changed

flang-rt/test/Driver/exec.f90

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
! REQUIRES: flang-rt
12
! Verify that flang can correctly build executables.
23

34
! RUN: %flang -L"%libdir" %s %deplibs -o %t

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ RUN: rm a.out
1212
*/
1313

1414
#include "flang/Runtime/entry-names.h"
15-
#include <stdbool.h>
16-
#include <stddef.h>
1715
#include <stdint.h>
1816

1917
/*

flang/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,9 @@ else()
223223
include_directories(SYSTEM ${MLIR_TABLEGEN_OUTPUT_DIR})
224224
endif()
225225

226+
option(FLANG_INCLUDE_RUNTIME "Build the runtime in-tree (deprecated; to be replaced with LLVM_ENABLE_RUNTIMES=flang-rt)" ON)
227+
pythonize_bool(FLANG_INCLUDE_RUNTIME)
228+
226229
set(FLANG_TOOLS_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}" CACHE PATH
227230
"Path for binary subdirectory (defaults to '${CMAKE_INSTALL_BINDIR}')")
228231
mark_as_advanced(FLANG_TOOLS_INSTALL_DIR)
@@ -450,7 +453,9 @@ if (FLANG_CUF_RUNTIME)
450453
find_package(CUDAToolkit REQUIRED)
451454
endif()
452455

453-
add_subdirectory(runtime)
456+
if (FLANG_INCLUDE_RUNTIME)
457+
add_subdirectory(runtime)
458+
endif ()
454459

455460
if (LLVM_INCLUDE_EXAMPLES)
456461
add_subdirectory(examples)

flang/docs/ReleaseNotes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ page](https://llvm.org/releases/).
3737
## Build System Changes
3838

3939
* The Fortran Runtime library has been move to a new top-level directory
40-
named "flang-rt". The library was also renamed from `libFortranRuntime.a` to
41-
`libflang_rt.a`. It now supports the
40+
named "flang-rt". The library was also renamed from `FortranRuntime` to
41+
`flang_rt`. It now supports the
4242
LLVM_ENABLE_RUNTIMES mechanism to build flang-rt for multiple target
4343
triples. libflang_rt.a will now be emitted into Clang's per-target
4444
resource directory (next to libclang_rt.*.*) where it is also found by

flang/lib/Optimizer/Builder/IntrinsicCall.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ prettyPrintIntrinsicName(fir::FirOpBuilder &builder, mlir::Location loc,
778778
// Generate a call to the Fortran runtime library providing
779779
// support for 128-bit float math.
780780
// On 'HAS_LDBL128' targets the implementation
781-
// is provided by FortranRuntime, otherwise, it is done via
781+
// is provided by flang_rt, otherwise, it is done via
782782
// FortranFloat128Math library. In the latter case the compiler
783783
// has to be built with FLANG_RUNTIME_F128_MATH_LIB to guarantee
784784
// proper linking actions in the driver.

flang/runtime/CMakeLists.txt

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -261,13 +261,13 @@ set(supported_files
261261
)
262262

263263
runtime_source_files(supported_files)
264-
enable_cuda_compilation(FortranRuntime "${supported_files}")
264+
enable_cuda_compilation(flang_rt "${supported_files}")
265265
enable_omp_offload_compilation("${supported_files}")
266266

267267
if (NOT TARGET FortranFloat128Math)
268268
# If FortranFloat128Math is not defined, then we are not building
269269
# standalone FortranFloat128Math library. Instead, include
270-
# the relevant sources into FortranRuntime itself.
270+
# the relevant sources into flang_rt itself.
271271
# The information is provided via FortranFloat128MathILib
272272
# interface library.
273273
get_target_property(f128_sources
@@ -298,47 +298,53 @@ runtime_source_files(sources)
298298

299299

300300
if (NOT DEFINED MSVC)
301-
add_flang_library(FortranRuntime
301+
add_flang_library(flang_rt
302302
${sources}
303303

304304
INSTALL_WITH_TOOLCHAIN
305305
)
306306
else()
307-
add_flang_library(FortranRuntime
307+
add_flang_library(flang_rt
308308
${sources}
309309
)
310310
set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded)
311-
add_flang_library(FortranRuntime.static ${sources}
311+
add_flang_library(flang_rt.static ${sources}
312312
INSTALL_WITH_TOOLCHAIN)
313-
set_target_properties(FortranRuntime.static PROPERTIES FOLDER "Flang/Runtime Libraries")
313+
set_target_properties(flang_rt.static PROPERTIES FOLDER "Flang/Runtime Libraries")
314314
set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreadedDLL)
315-
add_flang_library(FortranRuntime.dynamic ${sources}
315+
add_flang_library(flang_rt.dynamic ${sources}
316316
INSTALL_WITH_TOOLCHAIN)
317-
set_target_properties(FortranRuntime.dynamic PROPERTIES FOLDER "Flang/Runtime Libraries")
317+
set_target_properties(flang_rt.dynamic PROPERTIES FOLDER "Flang/Runtime Libraries")
318318
set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreadedDebug)
319-
add_flang_library(FortranRuntime.static_dbg ${sources}
319+
add_flang_library(flang_rt.static_dbg ${sources}
320320
INSTALL_WITH_TOOLCHAIN)
321-
set_target_properties(FortranRuntime.static_dbg PROPERTIES FOLDER "Flang/Runtime Libraries")
321+
set_target_properties(flang_rt.static_dbg PROPERTIES FOLDER "Flang/Runtime Libraries")
322322
set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreadedDebugDLL)
323-
add_flang_library(FortranRuntime.dynamic_dbg ${sources}
323+
add_flang_library(flang_rt.dynamic_dbg ${sources}
324324
INSTALL_WITH_TOOLCHAIN)
325-
set_target_properties(FortranRuntime.dynamic_dbg PROPERTIES FOLDER "Flang/Runtime Libraries")
326-
add_dependencies(FortranRuntime FortranRuntime.static FortranRuntime.dynamic
327-
FortranRuntime.static_dbg FortranRuntime.dynamic_dbg)
325+
set_target_properties(flang_rt.dynamic_dbg PROPERTIES FOLDER "Flang/Runtime Libraries")
326+
add_dependencies(flang_rt flang_rt.static flang_rt.dynamic
327+
flang_rt.static_dbg flang_rt.dynamic_dbg)
328328
endif()
329-
set_target_properties(FortranRuntime PROPERTIES FOLDER "Flang/Runtime Libraries")
329+
set_target_properties(flang_rt PROPERTIES FOLDER "Flang/Runtime Libraries")
330330

331-
# If FortranRuntime is part of a Flang build (and not a separate build) then
331+
# If flang_rt is part of a Flang build (and not a separate build) then
332332
# add dependency to make sure that Fortran runtime library is being built after
333333
# we have the Flang compiler available. This also includes the MODULE files
334334
# that compile when the 'flang' target is built.
335335
#
336336
# TODO: This is a workaround and should be updated when runtime build procedure
337337
# is changed to a regular runtime build. See discussion in PR #95388.
338338
if (TARGET flang AND TARGET module_files)
339-
add_dependencies(FortranRuntime flang module_files)
339+
add_dependencies(flang_rt flang module_files)
340340
endif()
341341

342342
if (FLANG_CUF_RUNTIME)
343343
add_subdirectory(CUDA)
344344
endif()
345+
346+
# Compatibility targets.
347+
add_custom_target(flang-rt)
348+
add_dependencies(flang-rt flang_rt)
349+
add_custom_target(FortranRuntime)
350+
add_dependencies(FortranRuntime flang_rt)

flang/runtime/CUDA/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ endif()
3636

3737
target_link_libraries(${CUFRT_LIBNAME}
3838
PRIVATE
39-
FortranRuntime
39+
flang_rt
4040
${CUDA_RT_TARGET}
4141
)

flang/runtime/Float128Math/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ elseif (HAVE_LDBL_MANT_DIG_113)
118118
)
119119
target_sources(FortranFloat128MathILib INTERFACE ${sources})
120120
else()
121-
message(FATAL_ERROR "FortranRuntime cannot build without libm")
121+
message(FATAL_ERROR "flang_rt cannot build without libm")
122122
endif()
123123
else()
124124
# We can use '__float128' version from libc, if it has them.

flang/test/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ set(FLANG_TEST_DEPENDS
7373
split-file
7474
FortranDecimal
7575
)
76+
77+
if (FLANG_INCLUDE_RUNTIME)
78+
list(APPEND FLANG_TEST_DEPENDS flang_rt)
79+
endif ()
80+
7681
if (LLVM_ENABLE_PLUGINS AND NOT WIN32)
7782
list(APPEND FLANG_TEST_DEPENDS Bye)
7883
endif()
@@ -119,3 +124,7 @@ if (DEFINED FLANG_TEST_TARGET_TRIPLE)
119124
"to use FLANG_TEST_TARGET_TRIPLE.")
120125
endif()
121126
endif()
127+
128+
# Compatibility targets.
129+
add_custom_target(check-flang-rt)
130+
add_dependencies(check-flang-rt check-flang)

flang/test/Driver/nostdlib.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@
2424
! in certain cases. But it is not clear that it is worth checking for each
2525
! platform individually.
2626

27-
! CHECK-NOT: "-lFortranRuntime"
27+
! CHECK-NOT: "-lflang_rt"
2828
! CHECK-NOT: "-lgcc"

0 commit comments

Comments
 (0)