Skip to content

Commit c1ce754

Browse files
committed
Merge branch 'users/meinersbur/flang_runtime' into users/meinersbur/flang_runtime_shared
2 parents 0450959 + 9aa355a commit c1ce754

File tree

12 files changed

+25
-17
lines changed

12 files changed

+25
-17
lines changed

flang-rt/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ set(FLANG_RT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
2323
set(FLANG_RT_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}")
2424
set(FLANG_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../flang")
2525

26-
2726
# CMake 3.24 is the first version of CMake that directly recognizes Flang.
2827
# LLVM's requirement is only CMake 3.20, teach CMake 3.20-3.23 how to use Flang.
2928
if (CMAKE_VERSION VERSION_LESS "3.24")

flang-rt/cmake/modules/AddFlangRTOffload.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ macro(enable_cuda_compilation name files)
5454
# Apply configuration options
5555
if (FLANG_RT_CUDA_RUNTIME_PTX_WITHOUT_GLOBAL_VARS)
5656
target_compile_definitions(obj.${name}PTX
57-
PRIVATE FLANG_RT_NO_GLOBAL_VAR_DEFS
57+
PRIVATE FLANG_RUNTIME_NO_GLOBAL_VAR_DEFS
5858
)
5959
endif()
6060

flang-rt/lib/flang_rt/allocator-registry.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111

1212
namespace Fortran::runtime {
1313

14-
#ifndef FLANG_RT_NO_GLOBAL_VAR_DEFS
14+
#ifndef FLANG_RUNTIME_NO_GLOBAL_VAR_DEFS
1515
RT_OFFLOAD_VAR_GROUP_BEGIN
1616
RT_VAR_ATTRS AllocatorRegistry allocatorRegistry;
1717
RT_OFFLOAD_VAR_GROUP_END
18-
#endif // FLANG_RT_NO_GLOBAL_VAR_DEFS
18+
#endif // FLANG_RUNTIME_NO_GLOBAL_VAR_DEFS
1919

2020
RT_OFFLOAD_API_GROUP_BEGIN
2121
RT_API_ATTRS void AllocatorRegistry::Register(int pos, Allocator_t allocator) {

flang-rt/lib/flang_rt/environment.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ extern char **environ;
2323

2424
namespace Fortran::runtime {
2525

26-
#ifndef FLANG_RT_NO_GLOBAL_VAR_DEFS
26+
#ifndef FLANG_RUNTIME_NO_GLOBAL_VAR_DEFS
2727
RT_OFFLOAD_VAR_GROUP_BEGIN
2828
RT_VAR_ATTRS ExecutionEnvironment executionEnvironment;
2929
RT_OFFLOAD_VAR_GROUP_END
30-
#endif // FLANG_RT_NO_GLOBAL_VAR_DEFS
30+
#endif // FLANG_RUNTIME_NO_GLOBAL_VAR_DEFS
3131

3232
static void SetEnvironmentDefaults(const EnvironmentDefaultList *envDefaults) {
3333
if (!envDefaults) {

flang-rt/lib/flang_rt/unit.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@
1919

2020
namespace Fortran::runtime::io {
2121

22-
#ifndef FLANG_RT_NO_GLOBAL_VAR_DEFS
22+
#ifndef FLANG_RUNTIME_NO_GLOBAL_VAR_DEFS
2323
RT_OFFLOAD_VAR_GROUP_BEGIN
2424
RT_VAR_ATTRS ExternalFileUnit *defaultInput{nullptr}; // unit 5
2525
RT_VAR_ATTRS ExternalFileUnit *defaultOutput{nullptr}; // unit 6
2626
RT_VAR_ATTRS ExternalFileUnit *errorOutput{nullptr}; // unit 0 extension
2727
RT_OFFLOAD_VAR_GROUP_END
28-
#endif // FLANG_RT_NO_GLOBAL_VAR_DEFS
28+
#endif // FLANG_RUNTIME_NO_GLOBAL_VAR_DEFS
2929

3030
RT_OFFLOAD_API_GROUP_BEGIN
3131

flang-rt/lib/flang_rt/utf.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
namespace Fortran::runtime {
1212

13-
#ifndef FLANG_RT_NO_GLOBAL_VAR_DEFS
13+
#ifndef FLANG_RUNTIME_NO_GLOBAL_VAR_DEFS
1414
// clang-format off
1515
RT_OFFLOAD_VAR_GROUP_BEGIN
1616
const RT_CONST_VAR_ATTRS std::uint8_t UTF8FirstByteTable[256]{
@@ -41,7 +41,7 @@ const RT_CONST_VAR_ATTRS std::uint8_t UTF8FirstByteTable[256]{
4141
};
4242
RT_OFFLOAD_VAR_GROUP_END
4343
// clang-format on
44-
#endif // FLANG_RT_NO_GLOBAL_VAR_DEFS
44+
#endif // FLANG_RUNTIME_NO_GLOBAL_VAR_DEFS
4545

4646
RT_OFFLOAD_API_GROUP_BEGIN
4747

flang-rt/test/Driver/ctofortran.f90

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
! UNSUPPORTED: system-windows
2+
! UNSUPPORTED: offload-cuda
23

34
! RUN: split-file %s %t
45
! RUN: %clang -I"%include/flang" -c %t/cfile.c -o %t/cfile.o
5-
! RUN: %flang -L"%libdir" %deplibs %t/ffile.f90 %t/cfile.o -o %t/ctofortran
6+
! RUN: %flang -L"%libdir" %t/ffile.f90 %t/cfile.o -o %t/ctofortran
67
! RUN: env LD_LIBRARY_PATH="$LD_LIBRARY_PATH:%libdir" %t/ctofortran | FileCheck %s
78

89
!--- ffile.f90

flang-rt/test/Driver/exec.f90

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
! REQUIRES: flang-rt
2+
! UNSUPPORTED: offload-cuda
3+
24
! Verify that flang can correctly build executables.
35

4-
! RUN: %flang -L"%libdir" %s %deplibs -o %t
6+
! RUN: %flang -L"%libdir" %s -o %t
57
! RUN: env LD_LIBRARY_PATH="$LD_LIBRARY_PATH:%libdir" %t | FileCheck %s
68

79
! CHECK: Hello, World!

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ library. It tries to link this simple file against libflang_rt.a with
44
a C compiler.
55
66
UNSUPPORTED: system-windows
7+
UNSUPPORTED: offload-cuda
78
89
RUN: %if system-aix %{ export OBJECT_MODE=64 %}
9-
RUN: %cc -std=c99 %s -I%include -L"%libdir" -lflang_rt -lm %deplibs \
10+
RUN: %cc -std=c99 %s -I%include -L"%libdir" -lflang_rt -lm \
1011
RUN: %if system-aix %{-lpthread %}
1112
RUN: rm a.out
1213
*/

flang-rt/test/lit.cfg.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,6 @@ def shjoin(args, sep=" "):
9797
# Library path of libflang_rt.a/.so (for lib search path when using non-Flang driver for linking and LD_LIBRARY_PATH)
9898
config.substitutions.append(("%libdir", config.flang_rt_output_resource_lib_dir))
9999

100-
# Additional library depedendencies the that Flang driver does not add itself.
101-
deplibs = []
100+
# For CUDA offloading, additional steps (device linking) and libraries (cudart) are needed.
102101
if config.flang_rt_experimental_offload_support == "CUDA":
103-
deplibs.append("-lcudart")
104-
config.substitutions.append(("%deplibs", shjoin(deplibs)))
102+
config.available_features.add("offload-cuda")

0 commit comments

Comments
 (0)