Skip to content

Commit a4b8e2c

Browse files
committed
Merge branch 'users/meinersbur/flang_runtime_shared' into users/meinersbur/flang_runtime_remove-FLANG_INCLUDE_RUNTIME
2 parents fbe7f6f + 60f62e0 commit a4b8e2c

File tree

9 files changed

+24
-16
lines changed

9 files changed

+24
-16
lines changed

flang-rt/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,9 @@ endif ()
234234
# but some older versions of CMake don't define it for GCC itself.
235235
check_cxx_compiler_flag("-UTESTFLAG" FLANG_RT_SUPPORTS_UNDEFINE_FLAG)
236236

237+
# Check whether -fno-lto is supported.
238+
check_cxx_compiler_flag(-fno-lto FLANG_RT_HAS_FNO_LTO_FLAG)
239+
237240

238241
# function checks
239242
find_package(Backtrace)

flang-rt/cmake/modules/AddFlangRT.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,13 @@ function (add_flangrt_library name)
237237
target_compile_options(${tgtname} PUBLIC -U_LIBCPP_ENABLE_ASSERTIONS)
238238
endif ()
239239

240+
# When building the flang runtime if LTO is enabled the archive file
241+
# contains LLVM IR rather than object code. Currently flang is not
242+
# LTO aware so cannot link this file to compiled Fortran code.
243+
if (FLANG_RT_HAS_FNO_LTO_FLAG)
244+
target_compile_options(${tgtname} PRIVATE -fno-lto)
245+
endif ()
246+
240247
# Flang/Clang (including clang-cl) -compiled programs targeting the MSVC ABI
241248
# should only depend on msvcrt/ucrt. LLVM still emits libgcc/compiler-rt
242249
# functions in some cases like 128-bit integer math (__udivti3, __modti3,

flang-rt/lib/cuda/allocator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include "flang-rt/cuda/allocator.h"
9+
#include "flang/Runtime/CUDA/allocator.h"
1010
#include "flang-rt/runtime/allocator-registry.h"
1111
#include "flang-rt/runtime/derived.h"
1212
#include "flang-rt/runtime/stat.h"

flang-rt/lib/cuda/descriptor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "flang/Runtime/CUDA/descriptor.h"
10-
#include "flang-rt/cuda/allocator.h"
1110
#include "flang-rt/runtime/descriptor.h"
1211
#include "flang-rt/runtime/terminator.h"
12+
#include "flang/Runtime/CUDA/allocator.h"
1313
#include "flang/Runtime/CUDA/common.h"
1414

1515
#include "cuda_runtime.h"

flang-rt/test/lit.cfg.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,19 +80,17 @@ def shjoin(args, sep=" "):
8080
extra_args=isysroot_flag,
8181
unresolved="fatal",
8282
),
83-
ToolSubst("%cc",
84-
command=config.cc,
85-
extra_args=isysroot_flag,
86-
unresolved="fatal"
87-
),
83+
ToolSubst("%cc", command=config.cc, extra_args=isysroot_flag, unresolved="fatal"),
8884
]
8985
llvm_config.add_tool_substitutions(tools)
9086

9187
# Let tests find LLVM's standard tools (FileCheck, split-file, not, ...)
9288
llvm_config.with_environment("PATH", config.llvm_tools_dir, append_path=True)
9389

9490
# Include path for C headers that define Flang's Fortran ABI.
95-
config.substitutions.append(("%include", os.path.join(config.flang_source_dir, "include")))
91+
config.substitutions.append(
92+
("%include", os.path.join(config.flang_source_dir, "include"))
93+
)
9694

9795
# Library path of libflang_rt.runtime.a/.so (for lib search path when using non-Flang driver for linking and LD_LIBRARY_PATH)
9896
config.substitutions.append(("%libdir", config.flang_rt_output_resource_lib_dir))

flang-rt/unittests/Runtime/CUDA/Allocatable.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
#include "flang/Runtime/allocatable.h"
1010
#include "cuda_runtime.h"
1111
#include "gtest/gtest.h"
12-
#include "flang-rt/cuda/allocator.h"
1312
#include "flang-rt/runtime/allocator-registry.h"
1413
#include "flang-rt/runtime/descriptor.h"
1514
#include "flang-rt/runtime/terminator.h"
15+
#include "flang/Runtime/CUDA/allocator.h"
1616
#include "flang/Runtime/CUDA/common.h"
1717
#include "flang/Runtime/CUDA/descriptor.h"
1818
#include "flang/Support/Fortran.h"

flang-rt/unittests/Runtime/CUDA/AllocatorCUF.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88

99
#include "cuda_runtime.h"
1010
#include "gtest/gtest.h"
11-
#include "flang-rt/cuda/allocator.h"
1211
#include "flang-rt/runtime/allocator-registry.h"
1312
#include "flang-rt/runtime/descriptor.h"
1413
#include "flang-rt/runtime/terminator.h"
14+
#include "flang/Runtime/CUDA/allocator.h"
1515
#include "flang/Runtime/CUDA/descriptor.h"
1616
#include "flang/Runtime/allocatable.h"
1717
#include "flang/Support/Fortran.h"

flang-rt/unittests/Runtime/CUDA/Memory.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
#include "cuda_runtime.h"
1111
#include "../tools.h"
1212
#include "gtest/gtest.h"
13-
#include "flang-rt/cuda/allocator.h"
1413
#include "flang-rt/runtime/allocator-registry.h"
1514
#include "flang-rt/runtime/terminator.h"
15+
#include "flang/Runtime/CUDA/allocator.h"
1616
#include "flang/Runtime/CUDA/common.h"
1717
#include "flang/Runtime/CUDA/descriptor.h"
1818
#include "flang/Runtime/allocatable.h"

flang-rt/include/flang-rt/CUDA/allocator.h renamed to flang/include/flang/Runtime/CUDA/allocator.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
//===-- include/flang-rt/cuda/allocator.h -----------------------*- C++ -*-===//
1+
//===-- include/flang/Runtime/CUDA/allocator.h ------------------*- 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.
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#ifndef FLANG_RT_CUDA_ALLOCATOR_H_
10-
#define FLANG_RT_CUDA_ALLOCATOR_H_
9+
#ifndef FORTRAN_RUNTIME_CUDA_ALLOCATOR_H_
10+
#define FORTRAN_RUNTIME_CUDA_ALLOCATOR_H_
1111

12-
#include "flang/Runtime/CUDA/common.h"
12+
#include "common.h"
1313
#include "flang/Runtime/descriptor-consts.h"
1414
#include "flang/Runtime/entry-names.h"
1515

@@ -33,4 +33,4 @@ void *CUFAllocUnified(std::size_t);
3333
void CUFFreeUnified(void *);
3434

3535
} // namespace Fortran::runtime::cuda
36-
#endif // FLANG_RT_CUDA_ALLOCATOR_H_
36+
#endif // FORTRAN_RUNTIME_CUDA_ALLOCATOR_H_

0 commit comments

Comments
 (0)