Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//===-- lib/Runtime/stack.h -------------------------------------*- C++ -*-===//
//===-- lib/flang_rt/stack.h ------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand All @@ -10,10 +10,10 @@
// It is a list based stack with dynamic allocation/deallocation
// of the list nodes.

#ifndef FORTRAN_RUNTIME_STACK_H_
#define FORTRAN_RUNTIME_STACK_H_
#ifndef FORTRAN_FLANG_RT_STACK_H_
#define FORTRAN_FLANG_RT_STACK_H_

#include "FortranRuntime/Runtime/memory.h"
#include "flang-rt/flang_rt/memory.h"
#include "terminator.h"

namespace Fortran::runtime {
Expand Down Expand Up @@ -133,4 +133,4 @@ template <typename T, unsigned N = 0> class Stack : public StackStorage<T, N> {
Terminator &terminator_;
};
} // namespace Fortran::runtime
#endif /* FORTRAN_RUNTIME_STACK_H_ */
#endif /* FORTRAN_FLANG_RT_STACK_H_ */
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//===-- lib/Runtime/stat.cpp ------------------------------------*- C++ -*-===//
//===-- lib/flang_rt/stat.cpp -----------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand All @@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//

#include "stat.h"
#include "FortranRuntime/Runtime/descriptor.h"
#include "flang-rt/flang_rt/descriptor.h"
#include "terminator.h"
#include "tools.h"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//===-- lib/Runtime/stat.h --------------------------------------*- C++ -*-===//
//===-- lib/flang_rt/stat.h -------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand All @@ -9,8 +9,8 @@
// Defines the values returned by the runtime for STAT= specifiers
// on executable statements.

#ifndef FORTRAN_RUNTIME_STAT_H_
#define FORTRAN_RUNTIME_STAT_H_
#ifndef FORTRAN_FLANG_RT_STAT_H_
#define FORTRAN_FLANG_RT_STAT_H_
#include "flang/Common/ISO_Fortran_binding_wrapper.h"
#include "flang/Common/api-attrs.h"
#include "flang/Runtime/magic-numbers.h"
Expand Down Expand Up @@ -60,4 +60,4 @@ RT_API_ATTRS int ToErrmsg(const Descriptor *errmsg, int stat); // returns stat
RT_API_ATTRS int ReturnError(Terminator &, int stat,
const Descriptor *errmsg = nullptr, bool hasStat = false);
} // namespace Fortran::runtime
#endif /* FORTRAN_RUNTIME_STAT_H_ */
#endif /* FORTRAN_FLANG_RT_STAT_H_ */
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//===-- lib/Runtime/stop.cpp ------------------------------------*- C++ -*-===//
//===-- lib/flang_rt/stop.cpp -----------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//===-- lib/Runtime/sum.cpp -------------------------------------*- C++ -*-===//
//===-- lib/flang_rt/sum.cpp ------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//===-- lib/Runtime/support.cpp ---------------------------------*- C++ -*-===//
//===-- lib/flang_rt/support.cpp --------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand All @@ -7,8 +7,8 @@
//===----------------------------------------------------------------------===//

#include "flang/Runtime/support.h"
#include "FortranRuntime/Runtime/descriptor.h"
#include "ISO_Fortran_util.h"
#include "flang-rt/flang_rt/descriptor.h"
#include "type-info.h"

namespace Fortran::runtime {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//===-- lib/Runtime/temporary-stack.cpp -------------------------*- C++ -*-===//
//===-- lib/flang_rt/temporary-stack.cpp ------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand All @@ -10,8 +10,8 @@
// temporaries. For use in HLFIR lowering.

#include "flang/Runtime/temporary-stack.h"
#include "FortranRuntime/Runtime/descriptor.h"
#include "FortranRuntime/Runtime/memory.h"
#include "flang-rt/flang_rt/descriptor.h"
#include "flang-rt/flang_rt/memory.h"
#include "terminator.h"
#include "flang/Common/ISO_Fortran_binding_wrapper.h"
#include "flang/Runtime/assign.h"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//===-- lib/Runtime/terminator.cpp ------------------------------*- C++ -*-===//
//===-- lib/flang_rt/terminator.cpp -----------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//===-- lib/Runtime/terminator.h --------------------------------*- C++ -*-===//
//===-- lib/flang_rt/terminator.h -------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand All @@ -8,8 +8,8 @@

// Termination of the image

#ifndef FORTRAN_RUNTIME_TERMINATOR_H_
#define FORTRAN_RUNTIME_TERMINATOR_H_
#ifndef FORTRAN_FLANG_RT_TERMINATOR_H_
#define FORTRAN_FLANG_RT_TERMINATOR_H_

#include "flang/Common/api-attrs.h"
#include <cstdarg>
Expand Down Expand Up @@ -121,4 +121,4 @@ namespace Fortran::runtime::io {
RT_API_ATTRS void FlushOutputOnCrash(const Terminator &);
}

#endif /* FORTRAN_RUNTIME_TERMINATOR_H_ */
#endif /* FORTRAN_FLANG_RT_TERMINATOR_H_ */
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//===-- lib/Runtime/time-intrinsic.cpp --------------------------*- C++ -*-===//
//===-- lib/flang_rt/time-intrinsic.cpp -------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand All @@ -9,7 +9,7 @@
// Implements time-related intrinsic subroutines.

#include "flang/Runtime/time-intrinsic.h"
#include "FortranRuntime/Runtime/descriptor.h"
#include "flang-rt/flang_rt/descriptor.h"
#include "terminator.h"
#include "tools.h"
#include "flang/Runtime/cpp-type.h"
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//===-- lib/Runtime/tools.cpp -----------------------------------*- C++ -*-===//
//===-- lib/flang_rt/tools.cpp ----------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
//===-- lib/Runtime/tools.h -------------------------------------*- C++ -*-===//
//===-- lib/flang_rt/tools.h ------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef FORTRAN_RUNTIME_TOOLS_H_
#define FORTRAN_RUNTIME_TOOLS_H_
#ifndef FORTRAN_FLANG_RT_TOOLS_H_
#define FORTRAN_FLANG_RT_TOOLS_H_

#include "FortranRuntime/Runtime/descriptor.h"
#include "FortranRuntime/Runtime/memory.h"
#include "flang-rt/flang_rt/descriptor.h"
#include "flang-rt/flang_rt/memory.h"
#include "stat.h"
#include "terminator.h"
#include "flang/Common/optional.h"
Expand Down Expand Up @@ -535,4 +535,4 @@ RT_API_ATTRS void CreatePartialReductionResult(Descriptor &result,
const char *intrinsic, TypeCode);

} // namespace Fortran::runtime
#endif /* FORTRAN_RUNTIME_TOOLS_H_ */
#endif /* FORTRAN_FLANG_RT_TOOLS_H_ */
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//===-- lib/Runtime/transformational.cpp ------------------------*- C++ -*-===//
//===-- lib/flang_rt/transformational.cpp -----------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand All @@ -17,8 +17,8 @@
// of the standard but it more likely to conform with its intent.

#include "flang/Runtime/transformational.h"
#include "FortranRuntime/Runtime/descriptor.h"
#include "copy.h"
#include "flang-rt/flang_rt/descriptor.h"
#include "terminator.h"
#include "tools.h"
#include "flang/Common/float128.h"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
//===-- lib/Runtime/type-code.cpp -------------------------------*- C++ -*-===//
//===-- lib/flang_rt/type-code.cpp ------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "FortranRuntime/Runtime/type-code.h"
#include "flang-rt/flang_rt/type-code.h"
#include <cstdint>

namespace Fortran::runtime {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//===-- lib/Runtime/type-info.cpp -------------------------------*- C++ -*-===//
//===-- lib/flang_rt/type-info.cpp ------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
//===-- lib/Runtime/type-info.h ---------------------------------*- C++ -*-===//
//===-- lib/flang_rt/type-info.h --------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef FORTRAN_RUNTIME_TYPE_INFO_H_
#define FORTRAN_RUNTIME_TYPE_INFO_H_
#ifndef FORTRAN_FLANG_RT_TYPE_INFO_H_
#define FORTRAN_FLANG_RT_TYPE_INFO_H_

// A C++ perspective of the derived type description schemata in
// flang/module/__fortran_type_info.f90.

#include "FortranRuntime/Runtime/descriptor.h"
#include "flang-rt/flang_rt/descriptor.h"
#include "terminator.h"
#include "flang/Common/Fortran-consts.h"
#include "flang/Common/bit-population-count.h"
Expand Down Expand Up @@ -321,4 +321,4 @@ class DerivedType {
};

} // namespace Fortran::runtime::typeInfo
#endif /* FORTRAN_RUNTIME_TYPE_INFO_H_ */
#endif /* FORTRAN_FLANG_RT_TYPE_INFO_H_ */
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//===-- lib/Runtime/unit-map.cpp --------------------------------*- C++ -*-===//
//===-- lib/flang_rt/unit-map.cpp -------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//===-- lib/Runtime/unit-map.h ----------------------------------*- C++ -*-===//
//===-- lib/flang_rt/unit-map.h ---------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand All @@ -9,10 +9,10 @@
// Maps Fortran unit numbers to their ExternalFileUnit instances.
// A simple hash table with forward-linked chains per bucket.

#ifndef FORTRAN_RUNTIME_UNIT_MAP_H_
#define FORTRAN_RUNTIME_UNIT_MAP_H_
#ifndef FORTRAN_FLANG_RT_UNIT_MAP_H_
#define FORTRAN_FLANG_RT_UNIT_MAP_H_

#include "FortranRuntime/Runtime/memory.h"
#include "flang-rt/flang_rt/memory.h"
#include "lock.h"
#include "unit.h"
#include "flang/Common/fast-int-set.h"
Expand Down Expand Up @@ -100,4 +100,4 @@ class UnitMap {
int emergencyNewUnit_{maxNewUnits_}; // not recycled
};
} // namespace Fortran::runtime::io
#endif /* FORTRAN_RUNTIME_UNIT_MAP_H_ */
#endif /* FORTRAN_FLANG_RT_UNIT_MAP_H_ */
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//===-- lib/Runtime/unit.cpp ------------------------------------*- C++ -*-===//
//===-- lib/flang_rt/unit.cpp -----------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand All @@ -19,13 +19,13 @@

namespace Fortran::runtime::io {

#ifndef FLANG_RUNTIME_NO_GLOBAL_VAR_DEFS
#ifndef FLANGRT_NO_GLOBAL_VAR_DEFS
RT_OFFLOAD_VAR_GROUP_BEGIN
RT_VAR_ATTRS ExternalFileUnit *defaultInput{nullptr}; // unit 5
RT_VAR_ATTRS ExternalFileUnit *defaultOutput{nullptr}; // unit 6
RT_VAR_ATTRS ExternalFileUnit *errorOutput{nullptr}; // unit 0 extension
RT_OFFLOAD_VAR_GROUP_END
#endif // FLANG_RUNTIME_NO_GLOBAL_VAR_DEFS
#endif // FLANGRT_NO_GLOBAL_VAR_DEFS

RT_OFFLOAD_API_GROUP_BEGIN

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//===-- lib/Runtime/unit.h --------------------------------------*- C++ -*-===//
//===-- lib/flang_rt/unit.h -------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand All @@ -8,14 +8,14 @@

// Fortran external I/O units

#ifndef FORTRAN_RUNTIME_UNIT_H_
#define FORTRAN_RUNTIME_UNIT_H_
#ifndef FORTRAN_FLANG_RT_UNIT_H_
#define FORTRAN_FLANG_RT_UNIT_H_

#include "FortranRuntime/Runtime/memory.h"
#include "buffer.h"
#include "connection.h"
#include "environment.h"
#include "file.h"
#include "flang-rt/flang_rt/memory.h"
#include "format.h"
#include "io-error.h"
#include "io-stmt.h"
Expand Down Expand Up @@ -291,4 +291,4 @@ class ChildIo {
};

} // namespace Fortran::runtime::io
#endif /* FORTRAN_RUNTIME_UNIT_H_ */
#endif /* FORTRAN_FLANG_RT_UNIT_H_ */
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//===-- lib/Runtime/utf.cpp -------------------------------------*- C++ -*-===//
//===-- lib/flang_rt/utf.cpp ------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand All @@ -10,7 +10,7 @@

namespace Fortran::runtime {

#ifndef FLANG_RUNTIME_NO_GLOBAL_VAR_DEFS
#ifndef FLANGRT_NO_GLOBAL_VAR_DEFS
// clang-format off
RT_OFFLOAD_VAR_GROUP_BEGIN
const RT_CONST_VAR_ATTRS std::uint8_t UTF8FirstByteTable[256]{
Expand Down Expand Up @@ -41,7 +41,7 @@ const RT_CONST_VAR_ATTRS std::uint8_t UTF8FirstByteTable[256]{
};
RT_OFFLOAD_VAR_GROUP_END
// clang-format on
#endif // FLANG_RUNTIME_NO_GLOBAL_VAR_DEFS
#endif // FLANGRT_NO_GLOBAL_VAR_DEFS

RT_OFFLOAD_API_GROUP_BEGIN

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//===-- lib/Runtime/utf.h ---------------------------------------*- C++ -*-===//
//===-- lib/flang_rt/utf.h --------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand Down Expand Up @@ -38,8 +38,8 @@
// standard maximum. However, we support extended forms up to 32 bits so that
// CHARACTER(KIND=4) can be abused to hold arbitrary 32-bit data.

#ifndef FORTRAN_RUNTIME_UTF_H_
#define FORTRAN_RUNTIME_UTF_H_
#ifndef FORTRAN_FLANG_RT_UTF_H_
#define FORTRAN_FLANG_RT_UTF_H_

#include "flang/Common/optional.h"
#include <cstddef>
Expand Down Expand Up @@ -70,4 +70,4 @@ RT_API_ATTRS Fortran::common::optional<char32_t> DecodeUTF8(const char *);
RT_API_ATTRS std::size_t EncodeUTF8(char *, char32_t);

} // namespace Fortran::runtime
#endif /* FORTRAN_RUNTIME_UTF_H_ */
#endif /* FORTRAN_FLANG_RT_UTF_H_ */
32 changes: 12 additions & 20 deletions FortranRuntime/test/CMakeLists.txt → flang-rt/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
)

if (TARGET FortranRuntimeUnitTests)
if (TARGET FlangRTUnitTests)
configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.py.in
${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg.py
Expand All @@ -41,29 +41,21 @@ if (TARGET FortranRuntimeUnitTests)
)
endif ()

set(FORTRANRUNTIME_TEST_DEPENDS
FortranRuntimeUnitTests
FortranRuntime.static
set(FLANGRT_TEST_DEPENDS
FlangRTUnitTests
flang_rt.unittest
)

add_custom_target(FortranRuntime-test-depends)
set_target_properties(FortranRuntime-test-depends PROPERTIES FOLDER "Fortran Runtime/Meta")
add_dependencies(FortranRuntime-test-depends ${FORTRANRUNTIME_TEST_DEPENDS})
add_custom_target(flang-rt-test-depends)
set_target_properties(flang-rt-test-depends PROPERTIES FOLDER "Fortran Runtime/Meta")
add_dependencies(flang-rt-test-depends ${FLANGRT_TEST_DEPENDS})

add_lit_testsuite(check-FortranRuntime "Running the FortranRuntime regression tests"
add_lit_testsuite(check-flang-rt "Running the flang-rt regression tests"
${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${FORTRANRUNTIME_TEST_DEPENDS}
DEPENDS ${FLANGRT_TEST_DEPENDS}
)
set_target_properties(check-FortranRuntime PROPERTIES FOLDER "Fortran Runtime/Meta")
set_target_properties(check-flang-rt PROPERTIES FOLDER "Fortran Runtime/Meta")


add_lit_testsuites(FORTRANRUNTIME ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${FORTRANRUNTIME_TEST_DEPENDS})

# To modify the default target triple for flang tests.
if (DEFINED FLANG_TEST_TARGET_TRIPLE)
if (NOT DEFINED LLVM_TARGET_TRIPLE_ENV OR LLVM_TARGET_TRIPLE_ENV STREQUAL "")
message(FATAL_ERROR "LLVM_TARGET_TRIPLE_ENV must also be defined in order "
"to use FLANG_TEST_TARGET_TRIPLE.")
endif()
endif()
add_lit_testsuites(flang-rt ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${FLANGRT_TEST_DEPENDS})
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
import lit.formats

# name: The name of this test suite.
config.name = "FortranRuntime-OldUnit"
config.name = "flang-rt-OldUnit"

# suffixes: A list of file extensions to treat as test files.
# On Windows, ".exe" also matches the GTests and will execited redundantly.
config.suffixes = [".test", ".exe"]

# test_source_root: The root path where unit test binaries are located.
config.test_source_root = os.path.join(config.fortranruntime_binary_dir, "unittests")
config.test_source_root = os.path.join(config.flangrt_binary_dir, "unittests")

# test_exec_root: The root path where tests should be run.
# lit writes a '.lit_test_times.txt' file into this directory.
config.test_exec_root = config.fortranruntime_binary_test_dir
config.test_exec_root = config.flangrt_binary_test_dir

# testFormat: The test format to use to interpret tests.
config.test_format = lit.formats.ExecutableTest()
14 changes: 14 additions & 0 deletions flang-rt/test/NonGtestUnit/lit.site.cfg.py.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@LIT_SITE_CFG_IN_HEADER@

import os

config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
config.flangrt_source_dir = "@FLANGRT_SOURCE_DIR@"
config.flangrt_binary_dir = "@FLANGRT_BINARY_DIR@"
config.flangrt_binary_test_dir = os.path.dirname(__file__)

import lit.llvm
lit.llvm.initialize(lit_config, config)

# Let the main config do the real work.
lit_config.load_config(config, os.path.join(config.flangrt_source_dir, 'test', 'NonGtestUnit', 'lit.cfg.py'))
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/*
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.a with
a C compiler.
UNSUPPORTED: system-windows
FIXME: This currently fails with CUDA-enabled FortranRuntime because it needs
to link libcuda_rt.
FIXME: This currently fails with CUDA-enabled flang-rt because it needs
to link libcudart.
RUN: %if system-aix %{ export OBJECT_MODE=64 %}
RUN: %cc -std=c99 %s -I%include %libruntime -lm \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
import lit.formats

# name: The name of this test suite.
config.name = "FortranRuntime-Unit"
config.name = "flang-rt-Unit"

# suffixes: A list of file extensions to treat as test files.
config.suffixes = []

# test_source_root: The root path where unit test binaries are located.
config.test_source_root = os.path.join(config.fortranruntime_binary_dir, "unittests")
config.test_source_root = os.path.join(config.flangrt_binary_dir, "unittests")

# test_exec_root: The root path where tests should be run.
# lit writes a '.lit_test_times.txt' file into this directory.
config.test_exec_root = config.fortranruntime_binary_test_dir
config.test_exec_root = config.flangrt_binary_test_dir

# testFormat: The test format to use to interpret tests.
config.test_format = lit.formats.GoogleTest(config.llvm_build_mode, "Tests")
15 changes: 15 additions & 0 deletions flang-rt/test/Unit/lit.site.cfg.py.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@LIT_SITE_CFG_IN_HEADER@

import os

config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
config.llvm_build_mode = "@LLVM_BUILD_MODE@"
config.flangrt_source_dir = "@FLANGRT_SOURCE_DIR@"
config.flangrt_binary_dir = "@FLANGRT_BINARY_DIR@"
config.flangrt_binary_test_dir = os.path.dirname(__file__)

import lit.llvm
lit.llvm.initialize(lit_config, config)

# Let the main config do the real work.
lit_config.load_config(config, os.path.join(config.flangrt_source_dir, 'test', 'Unit', 'lit.cfg.py'))
8 changes: 4 additions & 4 deletions FortranRuntime/test/lit.cfg.py → flang-rt/test/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# Configuration file for the 'lit' test runner.

# name: The name of this test suite.
config.name = "FortranRuntime"
config.name = "flang-rt"

# testFormat: The test format to use to interpret tests.
#
Expand Down Expand Up @@ -54,7 +54,7 @@

# test_exec_root: The root path where tests should be run.
# lit writes a '.lit_test_times.txt' file into this directory.
config.test_exec_root = config.fortranruntime_binary_test_dir
config.test_exec_root = config.flangrt_binary_test_dir

# On MacOS, -isysroot is needed to build binaries.
isysroot_flag = []
Expand All @@ -72,15 +72,15 @@

# Define some variables to help us test that the flang runtime doesn't depend on
# the C++ runtime libraries. For this we need a C compiler.
libruntime = os.path.join(config.fortranruntime_build_lib_dir, "libFortranRuntime.a")
libruntime = os.path.join(config.flangrt_build_lib_dir, "libflang_rt.a")
include = os.path.join(config.flang_source_dir, "include")
tools.append(
ToolSubst("%cc", command=config.cc, extra_args=isysroot_flag, unresolved="fatal")
)
tools.append(ToolSubst("%libruntime", command=libruntime, unresolved="fatal"))
tools.append(ToolSubst("%include", command=include, unresolved="fatal"))

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

llvm_config.add_tool_substitutions(tools)
17 changes: 17 additions & 0 deletions flang-rt/test/lit.site.cfg.py.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@LIT_SITE_CFG_IN_HEADER@

import sys

config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
config.flang_source_dir = "@FLANG_SOURCE_DIR@"
config.flangrt_source_dir = "@FLANGRT_SOURCE_DIR@"
config.flangrt_binary_test_dir = os.path.dirname(__file__)
config.flangrt_build_lib_dir = "@FLANGRT_BUILD_LIB_DIR@"
config.cc = "@CMAKE_C_COMPILER@"
config.osx_sysroot = path(r"@CMAKE_OSX_SYSROOT@")

import lit.llvm
lit.llvm.initialize(lit_config, config)

# Let the main config do the real work.
lit_config.load_config(config, os.path.join(config.flangrt_source_dir, 'test', 'lit.cfg.py'))
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ endif()


# Target that depends on all unittests
add_custom_target(FortranRuntimeUnitTests)
set_target_properties(FortranRuntimeUnitTests PROPERTIES FOLDER "Fortran Runtime/Meta")
add_custom_target(FlangRTUnitTests)
set_target_properties(FlangRTUnitTests PROPERTIES FOLDER "Fortran Runtime/Meta")


function(add_fortranruntime_unittest_offload_properties target)
function(add_flangrt_unittest_offload_properties target)
# Set CUDA_RESOLVE_DEVICE_SYMBOLS.
if (FORTRANRUNTIME_EXPERIMENTAL_OFFLOAD_SUPPORT STREQUAL "CUDA")
if (FLANG_RT_EXPERIMENTAL_OFFLOAD_SUPPORT STREQUAL "CUDA")
set_target_properties(${target}
PROPERTIES CUDA_RESOLVE_DEVICE_SYMBOLS ON
)
Expand All @@ -43,7 +43,7 @@ function(add_fortranruntime_unittest_offload_properties target)
#
# FIXME: replace 'native' in --offload-arch option with the list
# of targets that Fortran Runtime was built for.
if (FORTRANRUNTIME_EXPERIMENTAL_OFFLOAD_SUPPORT STREQUAL "OpenMP")
if (FLANG_RT_EXPERIMENTAL_OFFLOAD_SUPPORT STREQUAL "OpenMP")
set_target_properties(${target}
PROPERTIES LINK_OPTIONS
"-fopenmp;--offload-arch=native"
Expand All @@ -52,22 +52,22 @@ function(add_fortranruntime_unittest_offload_properties target)
endfunction()


function(add_fortranruntime_unittest test_dirname)
function(add_flangrt_unittest test_dirname)
cmake_parse_arguments(ARG
""
""
"LINK_LIBS"
${ARGN})

add_unittest(FortranRuntimeUnitTests ${test_dirname} ${ARG_UNPARSED_ARGUMENTS})
add_unittest(FlangRTUnitTests ${test_dirname} ${ARG_UNPARSED_ARGUMENTS})

target_include_directories(${test_dirname} PRIVATE "${FORTRANRUNTIME_SOURCE_DIR}/include")
target_include_directories(${test_dirname} PRIVATE "${FLANGRT_SOURCE_DIR}/include")
target_include_directories(${test_dirname} PRIVATE "${FLANG_SOURCE_DIR}/include")
target_link_libraries(${test_dirname} PRIVATE ${ARG_LINK_LIBS})
add_fortranruntime_unittest_offload_properties(${test_dirname})
add_flangrt_unittest_offload_properties(${test_dirname})
endfunction()

function(add_fortranruntime_nongtest_unittest test_name)
function(add_flangrt_nongtest_unittest test_name)
cmake_parse_arguments(ARG
"SLOW_TEST"
""
Expand All @@ -83,15 +83,15 @@ function(add_fortranruntime_nongtest_unittest test_name)
add_executable(${test_name}${suffix} ${ARG_UNPARSED_ARGUMENTS})
set_target_properties(${test_name}${suffix} PROPERTIES FOLDER "Fortran Runtime/Tests/Unit")

target_include_directories(${test_name}${suffix} PRIVATE "${FORTRANRUNTIME_SOURCE_DIR}/include")
target_include_directories(${test_name}${suffix} PRIVATE "${FLANGRT_SOURCE_DIR}/include")
target_include_directories(${test_name}${suffix} PRIVATE "${FLANG_SOURCE_DIR}/include")
target_link_libraries(${test_name}${suffix} PRIVATE NonGTestTesting ${ARG_LINK_LIBS})

if(NOT ARG_SLOW_TEST)
add_dependencies(FortranRuntimeUnitTests ${test_name}${suffix})
add_dependencies(FlangRTUnitTests ${test_name}${suffix})
endif()

add_fortranruntime_unittest_offload_properties(${test_name}${suffix})
add_flangrt_unittest_offload_properties(${test_name}${suffix})
endfunction()

add_subdirectory(Evaluate)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
#
#===------------------------------------------------------------------------===#

add_fortranruntime_nongtest_unittest(reshape
add_flangrt_nongtest_unittest(reshape
reshape.cpp
LINK_LIBS
FortranRuntime.unittest
flang_rt.unittest
)

add_fortranruntime_nongtest_unittest(ISO-Fortran-binding
add_flangrt_nongtest_unittest(ISO-Fortran-binding
ISO-Fortran-binding.cpp
LINK_LIBS
FortranRuntime.unittest
flang_rt.unittest
)
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//

#include "FortranRuntime/Runtime/descriptor.h"
#include "flang-rt/flang_rt/descriptor.h"
#include "flang/Common/ISO_Fortran_binding_wrapper.h"
#include "flang/Testing/testing.h"
#include "llvm/Support/raw_ostream.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//

#include "FortranRuntime/Runtime/descriptor.h"
#include "flang-rt/flang_rt/descriptor.h"
#include "flang/Runtime/transformational.h"
#include "flang/Testing/testing.h"
#include <cinttypes>
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
//
//===----------------------------------------------------------------------===//

#include "FortranRuntime/Runtime/array-constructor.h"
#include "FortranRuntime/Runtime/descriptor.h"
#include "FortranRuntime/Runtime/type-code.h"
#include "flang-rt/flang_rt/array-constructor.h"
#include "flang-rt/flang_rt/descriptor.h"
#include "flang-rt/flang_rt/type-code.h"
#include "gtest/gtest.h"
#include "tools.h"
#include "flang/Runtime/allocatable.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//

#include "../../lib/Runtime/buffer.h"
#include "../../lib/flang_rt/buffer.h"
#include "CrashHandlerFixture.h"
#include "gtest/gtest.h"
#include <algorithm>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#
#===------------------------------------------------------------------------===#

add_fortranruntime_unittest(FlangRuntimeTests
add_flangrt_unittest(RuntimeTests
AccessTest.cpp
Allocatable.cpp
ArrayConstructor.cpp
Expand Down Expand Up @@ -38,9 +38,9 @@ add_fortranruntime_unittest(FlangRuntimeTests
TemporaryStack.cpp
Transformational.cpp
LINK_LIBS
FortranRuntime.unittest
flang_rt.unittest
)

if (FORTRANRUNTIME_ENABLE_CUF)
if (FLANG_RT_ENABLE_CUF)
add_subdirectory(CUDA)
endif ()
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
//
//===----------------------------------------------------------------------===//

#include "FortranRuntime/Runtime/CUDA/allocator.h"
#include "FortranRuntime/Runtime/CUDA/descriptor.h"
#include "FortranRuntime/Runtime/allocatable.h"
#include "FortranRuntime/Runtime/allocator-registry.h"
#include "cuda_runtime.h"
#include "flang-rt/flang_rt/allocator-registry.h"
#include "flang-rt/flang_rt/descriptor.h"
#include "gtest/gtest.h"
#include "../../../runtime/terminator.h"
#include "../../../lib/flang_rt/terminator.h"
#include "flang-rt/CufRuntime/allocator.h"
#include "flang/Runtime/CUDA/descriptor.h"
#include "flang/Runtime/allocatable.h"
#include "flang/Support/Fortran.h"

#include "cuda_runtime.h"

using namespace Fortran::runtime;
using namespace Fortran::runtime::cuda;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
#
#===------------------------------------------------------------------------===#

add_fortranruntime_unittest(FlangCufRuntimeTests
add_flangrt_unittest(FlangCufRuntimeTests
AllocatorCUF.cpp
)

target_link_libraries(FlangCufRuntimeTests
PRIVATE
CufRuntime_cuda_${CUDAToolkit_VERSION_MAJOR}
FortranRuntime
flang_rt
)

target_include_directories(FlangCufRuntimeTests PRIVATE ${CUDAToolkit_INCLUDE_DIRS})
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// in Fortran.

#include "flang/Runtime/character.h"
#include "FortranRuntime/Runtime/descriptor.h"
#include "flang-rt/flang_rt/descriptor.h"
#include "gtest/gtest.h"
#include <cstring>
#include <functional>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//

#include "flang/Runtime/command.h"
#include "FortranRuntime/Runtime/descriptor.h"
#include "flang-rt/flang_rt/descriptor.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "flang/Runtime/execute.h"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
#include "CrashHandlerFixture.h"
#include "../../lib/Runtime/terminator.h"
#include "../../lib/flang_rt/terminator.h"
#include <cstdarg>
#include <cstdlib>

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//

#include "FortranRuntime/Runtime/descriptor.h"
#include "flang-rt/flang_rt/descriptor.h"
#include "gtest/gtest.h"
#include "tools.h"
#include "flang/Runtime/derived-api.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
//===----------------------------------------------------------------------===//

#include "CrashHandlerFixture.h"
#include "FortranRuntime/Runtime/descriptor.h"
#include "FortranRuntime/Runtime/io-api-funcs.h"
#include "flang-rt/flang_rt/descriptor.h"
#include "flang-rt/flang_rt/io-api-funcs.h"
#include "gtest/gtest.h"
#include "flang/Runtime/main.h"
#include "flang/Runtime/stop.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
//===----------------------------------------------------------------------===//

#include "CrashHandlerFixture.h"
#include "../../lib/Runtime/connection.h"
#include "../../lib/Runtime/format-implementation.h"
#include "../../lib/Runtime/io-error.h"
#include "../../lib/flang_rt/connection.h"
#include "../../lib/flang_rt/format-implementation.h"
#include "../../lib/flang_rt/io-error.h"
#include <optional>
#include <string>
#include <tuple>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//

#include "flang/Runtime/inquiry.h"
#include "FortranRuntime/Runtime/type-code.h"
#include "flang-rt/flang_rt/type-code.h"
#include "gtest/gtest.h"
#include "tools.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
//===----------------------------------------------------------------------===//

#include "CrashHandlerFixture.h"
#include "FortranRuntime/Runtime/descriptor.h"
#include "FortranRuntime/Runtime/io-api-funcs.h"
#include "../../lib/Runtime/io-error.h"
#include "flang-rt/flang_rt/descriptor.h"
#include "flang-rt/flang_rt/io-api-funcs.h"
#include "../../lib/flang_rt/io-error.h"

using namespace Fortran::runtime;
using namespace Fortran::runtime::io;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
//===----------------------------------------------------------------------===//

#include "CrashHandlerFixture.h"
#include "FortranRuntime/Runtime/descriptor.h"
#include "FortranRuntime/Runtime/io-api-funcs.h"
#include "flang-rt/flang_rt/descriptor.h"
#include "flang-rt/flang_rt/io-api-funcs.h"
#include <algorithm>
#include <array>
#include <cstring>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
//===----------------------------------------------------------------------===//

#include "flang/Runtime/matmul.h"
#include "FortranRuntime/Runtime/descriptor.h"
#include "FortranRuntime/Runtime/type-code.h"
#include "flang-rt/flang_rt/descriptor.h"
#include "flang-rt/flang_rt/type-code.h"
#include "gtest/gtest.h"
#include "tools.h"
#include "flang/Runtime/allocatable.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//

#include "FortranRuntime/Runtime/descriptor.h"
#include "FortranRuntime/Runtime/type-code.h"
#include "flang-rt/flang_rt/descriptor.h"
#include "flang-rt/flang_rt/type-code.h"
#include "gtest/gtest.h"
#include "tools.h"
#include "flang/Runtime/allocatable.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//

#include "FortranRuntime/Runtime/descriptor.h"
#include "flang-rt/flang_rt/descriptor.h"
#include "gtest/gtest.h"
#include "tools.h"
#include "flang/Runtime/allocatable.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
//
//===----------------------------------------------------------------------===//

#include "../../lib/Runtime/namelist.h"
#include "../../lib/flang_rt/namelist.h"
#include "CrashHandlerFixture.h"
#include "FortranRuntime/Runtime/descriptor.h"
#include "FortranRuntime/Runtime/io-api-funcs.h"
#include "flang-rt/flang_rt/descriptor.h"
#include "flang-rt/flang_rt/io-api-funcs.h"
#include "tools.h"
#include <algorithm>
#include <cinttypes>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
//===----------------------------------------------------------------------===//

#include "CrashHandlerFixture.h"
#include "FortranRuntime/Runtime/descriptor.h"
#include "FortranRuntime/Runtime/io-api-funcs.h"
#include "flang-rt/flang_rt/descriptor.h"
#include "flang-rt/flang_rt/io-api-funcs.h"
#include <algorithm>
#include <array>
#include <cstring>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//

#include "flang/Runtime/pointer.h"
#include "FortranRuntime/Runtime/descriptor.h"
#include "flang-rt/flang_rt/descriptor.h"
#include "gtest/gtest.h"
#include "tools.h"

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
//===----------------------------------------------------------------------===//

#include "flang/Runtime/random.h"
#include "FortranRuntime/Runtime/descriptor.h"
#include "FortranRuntime/Runtime/type-code.h"
#include "flang-rt/flang_rt/descriptor.h"
#include "flang-rt/flang_rt/type-code.h"
#include "gtest/gtest.h"
#include <cmath>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
//===----------------------------------------------------------------------===//

#include "flang/Runtime/reduction.h"
#include "FortranRuntime/Runtime/descriptor.h"
#include "FortranRuntime/Runtime/type-code.h"
#include "flang-rt/flang_rt/descriptor.h"
#include "flang-rt/flang_rt/type-code.h"
#include "gtest/gtest.h"
#include "tools.h"
#include "flang/Common/float128.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
//===----------------------------------------------------------------------===//
#include "CrashHandlerFixture.h"
#include "tools.h"
#include "../../lib/Runtime/terminator.h"
#include "../../lib/flang_rt/terminator.h"
#include "flang/Runtime/io-api.h"
#include "flang/Runtime/transformational.h"
#include <gtest/gtest.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//===----------------------------------------------------------------------===//
#include "flang/Runtime/stop.h"
#include "CrashHandlerFixture.h"
#include "../../lib/Runtime/environment.h"
#include "../../lib/flang_rt/environment.h"
#include <cstdlib>
#include <gtest/gtest.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//

#include "flang/Runtime/support.h"
#include "FortranRuntime/Runtime/descriptor.h"
#include "flang-rt/flang_rt/descriptor.h"
#include "gtest/gtest.h"
#include "tools.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//

#include "FortranRuntime/Runtime/descriptor.h"
#include "FortranRuntime/Runtime/type-code.h"
#include "flang-rt/flang_rt/descriptor.h"
#include "flang-rt/flang_rt/type-code.h"
#include "gtest/gtest.h"
#include "tools.h"
#include "flang/Common/ISO_Fortran_binding_wrapper.h"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//

#include "flang/Runtime/transformational.h"
#include "FortranRuntime/Runtime/type-code.h"
#include "flang-rt/flang_rt/type-code.h"
#include "gtest/gtest.h"
#include "tools.h"
#include "flang/Common/float128.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#ifndef FORTRAN_UNITTESTS_RUNTIME_TOOLS_H_
#define FORTRAN_UNITTESTS_RUNTIME_TOOLS_H_

#include "FortranRuntime/Runtime/descriptor.h"
#include "FortranRuntime/Runtime/type-code.h"
#include "flang-rt/flang_rt/descriptor.h"
#include "flang-rt/flang_rt/type-code.h"
#include "gtest/gtest.h"
#include "flang/Runtime/allocatable.h"
#include "flang/Runtime/cpp-type.h"
Expand Down
7 changes: 2 additions & 5 deletions flang/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ if (LLVM_ENABLE_EH)
endif()

set(FLANG_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(FORTRANRUNTIME_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../FortranRuntime")

if (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND NOT MSVC_IDE)
message(FATAL_ERROR "In-source builds are not allowed. \
Expand Down Expand Up @@ -247,13 +246,11 @@ set(LLVM_BUILD_TOOLS ON)

include_directories(BEFORE
${FLANG_BINARY_DIR}/include
${FLANG_SOURCE_DIR}/include
${FORTRANRUNTIME_SOURCE_DIR}/include)
${FLANG_SOURCE_DIR}/include)

# Add Flang-centric modules to cmake path.
list(INSERT CMAKE_MODULE_PATH 0
"${FLANG_SOURCE_DIR}/cmake/modules"
"${FORTRANRUNTIME_SOURCE_DIR}/cmake/modules"
"${LLVM_COMMON_CMAKE_UTILS}/Modules"
)
include(AddFlang)
Expand All @@ -271,7 +268,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\"), leave empty for platform default.")

if (NOT(FLANG_DEFAULT_RTLIB STREQUAL ""))
message(WARNING "Resetting Flang's default runtime library to use platform default.")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
#===-- cmake/modules/FlangCommon.txt ----------------------------===#
#
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#===------------------------------------------------------------------------===#
#
# CMake definitions shared betwween Flang and FortranRuntime
#
#===------------------------------------------------------------------------===#
# The out of tree builds of the compiler and the Fortran runtime
# must use the same setting of FLANG_RUNTIME_F128_MATH_LIB
# to be composable. Failure to synchronize this setting may result
# in linking errors or fatal failures in F128 runtime functions.
set(FLANG_RUNTIME_F128_MATH_LIB "" CACHE STRING
"Specifies the target library used for implementing IEEE-754 128-bit float \
math in F18 runtime, e.g. it might be libquadmath for targets where \
REAL(16) is mapped to __float128, or libm for targets where REAL(16) \
is mapped to long double, etc."
)
if (FLANG_RUNTIME_F128_MATH_LIB)
add_compile_definitions(FLANG_RUNTIME_F128_MATH_LIB="${FLANG_RUNTIME_F128_MATH_LIB}")
endif()
# Check if 128-bit float computations can be done via long double
check_cxx_source_compiles(
"#include <cfloat>
#if LDBL_MANT_DIG != 113
#error LDBL_MANT_DIG != 113
#endif
int main() { return 0; }
"
HAVE_LDBL_MANT_DIG_113)
include(TestBigEndian)
test_big_endian(IS_BIGENDIAN)
if (IS_BIGENDIAN)
add_compile_definitions(FLANG_BIG_ENDIAN=1)
else ()
add_compile_definitions(FLANG_LITTLE_ENDIAN=1)
endif ()
#===-- cmake/modules/FlangCommon.txt ----------------------------===#
#
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#===------------------------------------------------------------------------===#
#
# CMake definitions shared between Flang and Flang-RT
#
#===------------------------------------------------------------------------===#

# The out of tree builds of the compiler and the Fortran runtime
# must use the same setting of FLANG_RUNTIME_F128_MATH_LIB
# to be composable. Failure to synchronize this setting may result
# in linking errors or fatal failures in F128 runtime functions.
set(FLANG_RUNTIME_F128_MATH_LIB "" CACHE STRING
"Specifies the target library used for implementing IEEE-754 128-bit float \
math in F18 runtime, e.g. it might be libquadmath for targets where \
REAL(16) is mapped to __float128, or libm for targets where REAL(16) \
is mapped to long double, etc."
)
if (FLANG_RUNTIME_F128_MATH_LIB)
add_compile_definitions(FLANG_RUNTIME_F128_MATH_LIB="${FLANG_RUNTIME_F128_MATH_LIB}")
endif()

# Check if 128-bit float computations can be done via long double
check_cxx_source_compiles(
"#include <cfloat>
#if LDBL_MANT_DIG != 113
#error LDBL_MANT_DIG != 113
#endif
int main() { return 0; }
"
HAVE_LDBL_MANT_DIG_113)

include(TestBigEndian)
test_big_endian(IS_BIGENDIAN)
if (IS_BIGENDIAN)
add_compile_definitions(FLANG_BIG_ENDIAN=1)
else ()
add_compile_definitions(FLANG_LITTLE_ENDIAN=1)
endif ()
8 changes: 4 additions & 4 deletions flang/docs/FlangDriver.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,18 +179,18 @@ like this:

```
$ flang -v -o example example.o
"/usr/bin/ld" [...] example.o [...] "-lFortranRuntime" [...]
"/usr/bin/ld" [...] example.o [...] "-lflang_rt" [...]
```

The automatically added libraries are:

* `FortranRuntime`: Provides most of the Flang runtime library.
* `flang_rt`: 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 libraries
`FortranRuntime`. An alternative is to use Flang to link.
In this case, one has to explicitly provide the Fortran runtime library
`flang_ty`. 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)
Expand Down
34 changes: 17 additions & 17 deletions flang/docs/GettingStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ tool.

### Building flang in tree (bootstrap build)
Building flang in tree means building flang along with all of the projects on
which it depends. These projects include mlir, clang, flang, openmp,
compiler-rt, and FortranRuntime. Note that compiler-rt is only needed to access libraries that
which it depends. These projects include mlir, clang, flang, openmp, and
compiler-rt. Note that compiler-rt is only needed to access libraries that
support 16 bit floating point numbers. It's not needed to run the automated
tests. You can use several different C++ compilers for most of the build,
includig GNU and clang. But building compiler-rt requres using the clang
Expand Down Expand Up @@ -82,7 +82,7 @@ cmake \
-DLLVM_TARGETS_TO_BUILD=host \
-DLLVM_LIT_ARGS=-v \
-DLLVM_ENABLE_PROJECTS="clang;mlir;flang;openmp" \
-DLLVM_ENABLE_RUNTIMES="compiler-rt;FortranRuntime" \
-DLLVM_ENABLE_RUNTIMES="compiler-rt;flang_rt" \
../llvm-project/llvm

ninja
Expand Down Expand Up @@ -209,15 +209,15 @@ mkdir build_flang_runtime
cd build_flang_runtime

cmake \
-DLLVM_ENABLE_RUNTIMES=FortranRuntime \
-DFORTRANRUNTIME_EXPERIMENTAL_OFFLOAD_SUPPORT=CUDA \
-DLLVM_ENABLE_RUNTIMES=flang_rt \
-DFLANG_RT_EXPERIMENTAL_OFFLOAD_SUPPORT=CUDA \
-DCMAKE_CUDA_ARCHITECTURES=80 \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_CUDA_COMPILER=clang \
-DCMAKE_CUDA_HOST_COMPILER=clang++ \
../runtimes/
make -j`nprocs` FortranRuntime
make -j`nprocs` 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)
Expand All @@ -232,16 +232,16 @@ mkdir build_flang_runtime
cd build_flang_runtime

cmake \
-DLLVM_ENABLE_RUNTIMES=FortranRuntime \
-DFORTRANRUNTIME_EXPERIMENTAL_OFFLOAD_SUPPORT=CUDA \
-DLLVM_ENABLE_RUNTIMES=flang_rt \
-DFLANG_RT_EXPERIMENTAL_OFFLOAD_SUPPORT=CUDA \
-DCMAKE_CUDA_ARCHITECTURES=80 \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_CUDA_COMPILER=nvcc \
-DCMAKE_CUDA_HOST_COMPILER=clang++ \
../runtimes/

make -j`nprocs` FortranRuntime
make -j`nprocs` flang_rt
```

Note that `nvcc` might limit support to certain
Expand All @@ -260,8 +260,8 @@ build config:

For example:
```bash
-DLLVM_ENABLE_RUNTIMES=FortranRuntime \
-DFORTRANRUNTIME_EXPERIMENTAL_OFFLOAD_SUPPORT=CUDA \
-DLLVM_ENABLE_RUNTIMES=flang_rt \
-DFLANG_RT_EXPERIMENTAL_OFFLOAD_SUPPORT=CUDA \
-DCMAKE_CUDA_ARCHITECTURES=80 \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
Expand All @@ -272,8 +272,8 @@ For example:

Or:
```bash
-DLLVM_ENABLE_RUNTIMES=FortranRuntime \
-DFORTRANRUNTIME_EXPERIMENTAL_OFFLOAD_SUPPORT=CUDA \
-DLLVM_ENABLE_RUNTIMES=flang_rt \
-DFLANG_RT_EXPERIMENTAL_OFFLOAD_SUPPORT=CUDA \
-DCMAKE_CUDA_ARCHITECTURES=80 \
-DCMAKE_C_COMPILER=gcc \
-DCMAKE_CXX_COMPILER=g++ \
Expand All @@ -295,14 +295,14 @@ mkdir build_flang_runtime
cd build_flang_runtime

cmake \
-DLLVM_ENABLE_RUNTIMES=FortranRuntime \
-DFORTRANRUNTIME_EXPERIMENTAL_OFFLOAD_SUPPORT="OpenMP" \
-DLLVM_ENABLE_RUNTIMES=flang_rt \
-DFLANG_RT_EXPERIMENTAL_OFFLOAD_SUPPORT="OpenMP" \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DFORTRANRUNTIME_DEVICE_ARCHITECTURES="all" \
-DFLANG_RT_DEVICE_ARCHITECTURES="all" \
../runtimes/

make -j`nprocs` FortranRuntime
make -j`nprocs` flang_rt
```

The result of the build is a "device-only" library, i.e. the host
Expand Down
2 changes: 1 addition & 1 deletion flang/docs/OpenACC-descriptor-management.md
Original file line number Diff line number Diff line change
Expand Up @@ -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` and `liboffload`. The F18 driver adds `FortranOffloadRuntime` for linking under `-fopenacc`/`-fopenmp` (and maybe additional switches like `-fopenmp-targets`).

## TODOs:

Expand Down
13 changes: 7 additions & 6 deletions flang/docs/ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@ page](https://llvm.org/releases/).

## Build System Changes

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

## New Issues Found

Expand Down
2 changes: 1 addition & 1 deletion flang/examples/ExternalHelloWorld/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ add_llvm_example(external-hello-world

target_link_libraries(external-hello-world
PRIVATE
FortranRuntime
flang_rt
)
6 changes: 4 additions & 2 deletions flang/include/flang/Common/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Files in this directory are used by Flang (the compiler) and FortranRuntime
Files in this directory are used by Flang (the compiler) and flang-rt
(the runtime library for Flang-compiled programs). They must be compatible by
both. For definitions used only by Flang, consider
`flang/{lib,include/flang}/Support` instead. For definitions used only by
FortranRuntime, consider `FortranRuntime/{lib,include/FortranRuntime}/Runtime`.
the runtime, consider `flang-rt/{lib,include/flang-rt}/flang_rt`.

The requirements for common code include:

Expand All @@ -23,3 +23,5 @@ The requirements for common code include:

* Global declarations may need to be annotated using definitions from
`api-attrs.h`.

* The `Runtime` component is header-only.
16 changes: 12 additions & 4 deletions flang/include/flang/ISO_Fortran_binding.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
//===-- include/flang/ISO_Fortran_binding.h ---------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

/*===-- include/flang/ISO_Fortran_binding.h -----------------------*- C++ -*-===
*
* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
Expand All @@ -7,14 +15,14 @@
* ===-----------------------------------------------------------------------===
*/

#ifndef CFI_ISO_FORTRAN_BINDING_H_
#define CFI_ISO_FORTRAN_BINDING_H_
#ifndef FORTRAN_ISO_FORTRAN_BINDING_H_
#define FORTRAN_ISO_FORTRAN_BINDING_H_

/* When this header is included into the compiler and runtime implementations,
* it does so by means of a wrapper header that establishes namespaces and
* a macro for extra function attributes (RT_API_ATTRS).
*/
#ifndef FORTRAN_ISO_FORTRAN_BINDING_WRAPPER_H_
#ifndef FORTRAN_COMMON_ISO_FORTRAN_BINDING_WRAPPER_H_
#include <stddef.h>
#define FORTRAN_ISO_NAMESPACE_
#endif
Expand Down Expand Up @@ -207,4 +215,4 @@ RT_API_ATTRS int CFI_setpointer(
} // extern "C"
#endif

#endif /* CFI_ISO_FORTRAN_BINDING_H_ */
#endif /* FORTRAN_ISO_FORTRAN_BINDING_H_ */
4 changes: 2 additions & 2 deletions flang/include/flang/Runtime/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Files in this directory are used by Flang (the compiler) and FortranRuntime
Files in this directory are used by Flang (the compiler) and flang-rt
(the runtime library for Flang-compiled programs). They must be compatible by
both. For definitions used only by Flang, consider
`flang/{lib,include/flang}/Support` instead. For definitions used only by
FortranRuntime, consider `FortranRuntime/{lib,include/FortranRuntime}/Runtime`.
the runtime, consider `flang-rt/{lib,include/flang-rt}/flang_rt`.

The requirements for common code include:

Expand Down
6 changes: 4 additions & 2 deletions flang/include/flang/Testing/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Files in this directory are used by Flang (the compiler) and FortranRuntime
Files in this directory are used by Flang (the compiler) and flang-rt
(the runtime library for Flang-compiled programs). They must be compatible by
both. For definitions used only by Flang, consider
`flang/{lib,include/flang}/Support` instead. For definitions used only by
FortranRuntime, consider `FortranRuntime/{lib,include/FortranRuntime}/Runtime`.
the runtime, consider `flang-rt/{lib,include/flang-rt}/flang_rt`.

The requirements for common code include:

Expand All @@ -23,3 +23,5 @@ The requirements for common code include:

* Global declarations may need to be annotated using definitions from
`api-attrs.h`.

* The `Runtime` component is header-only.
6 changes: 4 additions & 2 deletions flang/lib/Common/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Files in this directory are used by Flang (the compiler) and FortranRuntime
Files in this directory are used by Flang (the compiler) and flang-rt
(the runtime library for Flang-compiled programs). They must be compatible by
both. For definitions used only by Flang, consider
`flang/{lib,include/flang}/Support` instead. For definitions used only by
FortranRuntime, consider `FortranRuntime/{lib,include/FortranRuntime}/Runtime`.
the runtime, consider `flang-rt/{lib,include/flang-rt}/flang_rt`.

The requirements for common code include:

Expand All @@ -23,3 +23,5 @@ The requirements for common code include:

* Global declarations may need to be annotated using definitions from
`api-attrs.h`.

* The `Runtime` component is header-only.
2 changes: 1 addition & 1 deletion flang/lib/Optimizer/Builder/IntrinsicCall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ prettyPrintIntrinsicName(fir::FirOpBuilder &builder, mlir::Location loc,
// Generate a call to the Fortran runtime library providing
// support for 128-bit float math.
// On 'LDBL_MANT_DIG == 113' targets the implementation
// is provided by FortranRuntime, otherwise, it is done via
// is provided by flang-rt, otherwise, it is done via
// FortranFloat128Math 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.
Expand Down
2 changes: 1 addition & 1 deletion flang/lib/Optimizer/Transforms/CufOpConversion.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//===-- CufOpConversion.cpp -----------------------------------------------===//
//===-- lib/Optimizer/Transforms/CufOpConversion.cpp ------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand Down
20 changes: 0 additions & 20 deletions flang/lib/Testing/CMakeLists.txt

This file was deleted.

6 changes: 4 additions & 2 deletions flang/lib/Testing/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Files in this directory are used by Flang (the compiler) and FortranRuntime
Files in this directory are used by Flang (the compiler) and flang-rt
(the runtime library for Flang-compiled programs). They must be compatible by
both. For definitions used only by Flang, consider
`flang/{lib,include/flang}/Support` instead. For definitions used only by
FortranRuntime, consider `FortranRuntime/{lib,include/FortranRuntime}/Runtime`.
the runtime, consider `flang-rt/{lib,include/flang-rt}/flang_rt`.

The requirements for common code include:

Expand All @@ -23,3 +23,5 @@ The requirements for common code include:

* Global declarations may need to be annotated using definitions from
`api-attrs.h`.

* The `Runtime` component is header-only.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
!===-- lib/Runtime/iso_fortran_env_impl.f90 --------------------------------===!
!===-- module/iso_fortran_env_impl.f90 --=--------------------------------===!
!
! Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
! See https://llvm.org/LICENSE.txt for license information.
Expand All @@ -8,7 +8,7 @@

! This MODULE implements part of the ISO_FORTRAN_ENV module file, which
! partially requires linkable symbols for some entities defined
! (e.g., real_kinds).
! (e.g., real_kinds). Hence, this file is also used by Flang-RT.

module iso_fortran_env_impl
implicit none
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Driver/gcc-toolchain-install-dir.f90
Original file line number Diff line number Diff line change
@@ -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, 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
Expand Down
8 changes: 4 additions & 4 deletions flang/test/Driver/linker-flags.f90
Original file line number Diff line number Diff line change
Expand Up @@ -33,26 +33,26 @@
! 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-SAME: "-lflang_rt" "-lm"
! COMPILER-RT: "{{.*}}{{\\|/}}libclang_rt.builtins.a"

! 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-SAME: -lflang_rt

! 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-SAME: "-lflang_rt"

! 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-SAME: -lflang_rt

! 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
Expand Down
8 changes: 4 additions & 4 deletions flang/test/Driver/msvc-dependent-lib-flags.f90
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@
! MSVC: -fc1
! MSVC-SAME: -D_MT
! MSVC-SAME: --dependent-lib=libcmt
! MSVC-SAME: --dependent-lib=FortranRuntime.static.lib
! MSVC-SAME: --dependent-lib=flang_rt.static.lib

! MSVC-DEBUG: -fc1
! 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.static_dbg.lib

! MSVC-DLL: -fc1
! 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.dynamic.lib

! MSVC-DLL-DEBUG: -fc1
! MSVC-DLL-DEBUG-SAME: -D_MT
! 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.dynamic_dbg.lib
24 changes: 6 additions & 18 deletions flang/tools/f18/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ if (NOT CMAKE_CROSSCOMPILING)
foreach(filename ${MODULES})
set(depends "")
set(opts "")
set(sourcepath "${FLANG_SOURCE_DIR}/module/${filename}.f90")
set(modpath "${FLANG_INTRINSIC_MODULES_DIR}/${filename}.mod")
if(${filename} STREQUAL "__fortran_builtins" OR
${filename} STREQUAL "__ppc_types")
elseif(${filename} STREQUAL "__ppc_intrinsics" OR
Expand All @@ -66,9 +64,6 @@ if (NOT CMAKE_CROSSCOMPILING)
set(depends ${FLANG_INTRINSIC_MODULES_DIR}/__cuda_builtins.mod)
else()
set(depends ${FLANG_INTRINSIC_MODULES_DIR}/__fortran_builtins.mod)
if(${filename} STREQUAL "iso_fortran_env_impl")
set(sourcepath "${FORTRANRUNTIME_SOURCE_DIR}/lib/Runtime/${filename}.f90")
endif()
if(${filename} STREQUAL "iso_fortran_env")
set(depends ${depends} ${FLANG_INTRINSIC_MODULES_DIR}/iso_fortran_env_impl.mod)
endif()
Expand Down Expand Up @@ -97,27 +92,20 @@ if (NOT CMAKE_CROSSCOMPILING)
set(decls "-DFLANG_SUPPORT_R16")
endif()

# Some modules have an implementation part that needs to be added to the
# FortranRuntime library.
set(compile_with "-fsyntax-only")
set(object_output "")
set(include_in_link FALSE)

set(base ${FLANG_INTRINSIC_MODULES_DIR}/${filename})
# TODO: We may need to flag this with conditional, in case Flang is built w/o OpenMP support
add_custom_command(OUTPUT ${modpath} ${object_output}
add_custom_command(OUTPUT ${base}.mod ${object_output}
COMMAND ${CMAKE_COMMAND} -E make_directory ${FLANG_INTRINSIC_MODULES_DIR}
COMMAND flang-new ${opts} ${decls} -cpp ${compile_with} -module-dir ${FLANG_INTRINSIC_MODULES_DIR}
${sourcepath}
DEPENDS flang-new ${sourcepath} ${FLANG_SOURCE_DIR}/module/__fortran_builtins.f90 ${depends}
${FLANG_SOURCE_DIR}/module/${filename}.f90
DEPENDS flang-new ${FLANG_SOURCE_DIR}/module/${filename}.f90 ${FLANG_SOURCE_DIR}/module/__fortran_builtins.f90 ${depends}
)
list(APPEND MODULE_FILES "${modpath}")
install(FILES "${modpath}" 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.
if(include_in_link)
list(APPEND module_objects ${object_output})
endif()
list(APPEND MODULE_FILES ${base}.mod)
install(FILES ${base}.mod DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/flang")
endforeach()

# Special case for omp_lib.mod, because its source comes from openmp/runtime/src/include.
Expand Down
4 changes: 2 additions & 2 deletions flang/unittests/Common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#
#===------------------------------------------------------------------------===#

add_fortranruntime_unittest(FlangCommonTests
add_flangrt_unittest(FlangCommonTests
FastIntSetTest.cpp
LINK_LIBS
FortranRuntime.unittest
flang_rt.unittest
)
8 changes: 4 additions & 4 deletions flang/unittests/Decimal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
#
#===------------------------------------------------------------------------===#

add_fortranruntime_nongtest_unittest(quick-sanity-test
add_flangrt_nongtest_unittest(quick-sanity-test
quick-sanity-test.cpp
LINK_LIBS
FortranRuntime.unittest
flang_rt.unittest
)

# This test is not run by default as it takes a long time to execute.
add_fortranruntime_nongtest_unittest(thorough-test SLOW_TEST
add_flangrt_nongtest_unittest(thorough-test SLOW_TEST
thorough-test.cpp
LINK_LIBS
FortranRuntime.unittest
flang_rt.unittest
)
10 changes: 5 additions & 5 deletions lld/COFF/MinGW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ AutoExporter::AutoExporter(
"libclang_rt.profile-x86_64",
"libc++",
"libc++abi",
"libFortranRuntime",
"libFortranRuntime.static",
"libFortranRuntime.dynamic",
"libFortranRuntime.static_dbg",
"libFortranRuntime.dynamic_dbg",
"libflang_rt",
"libflang_rt.static",
"libflang_rt.dynamic",
"libflang_rtstatic_dbg",
"libflang_rt.dynamic_dbg",
"libunwind",
"libmsvcrt",
"libucrtbase",
Expand Down
2 changes: 1 addition & 1 deletion llvm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ endif()
# As we migrate runtimes to using the bootstrapping build, the set of default runtimes
# should grow as we remove those runtimes from LLVM_ENABLE_PROJECTS above.
set(LLVM_DEFAULT_RUNTIMES "libcxx;libcxxabi;libunwind")
set(LLVM_SUPPORTED_RUNTIMES "libc;libunwind;libcxxabi;pstl;libcxx;compiler-rt;openmp;llvm-libgcc;offload;FortranRuntime")
set(LLVM_SUPPORTED_RUNTIMES "libc;libunwind;libcxxabi;pstl;libcxx;compiler-rt;openmp;llvm-libgcc;offload;flang-rt")
set(LLVM_ENABLE_RUNTIMES "" CACHE STRING
"Semicolon-separated list of runtimes to build, or \"all\" (${LLVM_DEFAULT_RUNTIMES}). Supported runtimes are ${LLVM_SUPPORTED_RUNTIMES}.")
if(LLVM_ENABLE_RUNTIMES STREQUAL "all")
Expand Down
4 changes: 2 additions & 2 deletions llvm/projects/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ foreach(entry ${entries})
(NOT ${entry} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/test-suite) AND
(NOT ${entry} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/openmp) AND
(NOT ${entry} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/cross-project-tests) AND
(NOT ${entry} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/FortranRuntime))
(NOT ${entry} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/flang-rt))
get_filename_component(entry_name "${entry}" NAME)
add_llvm_external_project(${entry_name})
endif()
Expand All @@ -38,7 +38,7 @@ if(${LLVM_BUILD_RUNTIME})
if(NOT LLVM_BUILD_EXTERNAL_COMPILER_RT)
add_llvm_external_project(compiler-rt)
endif()
add_llvm_external_project(FortranRuntime)
add_llvm_external_project(flang-rt)
endif()

add_llvm_external_project(dragonegg)
Expand Down
6 changes: 3 additions & 3 deletions llvm/runtimes/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,8 @@ function(runtime_default_target)
${ARG_CMAKE_ARGS}
PASSTHROUGH_PREFIXES LLVM_ENABLE_RUNTIMES
LLVM_USE_LINKER
CUDA # For runtimes that may look for the CUDA SDK (libc, offload)
FLANG_RUNTIME # Shared between Flang and FortranRuntime
CUDA # For runtimes that may look for the CUDA SDK (libc, offload, flang-rt)
FLANG_RUNTIME # Shared between Flang and Flang-RT
${ARG_PREFIXES}
EXTRA_TARGETS ${extra_targets}
${test_targets}
Expand Down Expand Up @@ -573,7 +573,7 @@ if(build_runtimes)
if(LLVM_LIBC_FULL_BUILD)
list(APPEND extra_cmake_args "-DLLVM_LIBC_FULL_BUILD=ON")
endif()
if("FortranRuntime" IN_LIST LLVM_ENABLE_RUNTIMES)
if("flang-rt" IN_LIST LLVM_ENABLE_RUNTIMES)
set(enable_fortran ENABLE_FORTRAN)
endif ()

Expand Down
4 changes: 2 additions & 2 deletions runtimes/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ list(INSERT CMAKE_MODULE_PATH 0

# We order libraries to mirror roughly how they are layered, except that compiler-rt can depend
# on libc++, so we put it after.
set(LLVM_DEFAULT_RUNTIMES "libc;libunwind;libcxxabi;pstl;libcxx;compiler-rt;openmp;offload;FortranRuntime")
set(LLVM_SUPPORTED_RUNTIMES "${LLVM_DEFAULT_RUNTIMES};llvm-libgcc")
set(LLVM_DEFAULT_RUNTIMES "libc;libunwind;libcxxabi;pstl;libcxx;compiler-rt;openmp;offload")
set(LLVM_SUPPORTED_RUNTIMES "${LLVM_DEFAULT_RUNTIMES};llvm-libgcc;flang-rt")
set(LLVM_ENABLE_RUNTIMES "" CACHE STRING
"Semicolon-separated list of runtimes to build, or \"all\" (${LLVM_DEFAULT_RUNTIMES}). Supported runtimes are ${LLVM_SUPPORTED_RUNTIMES}.")
if(LLVM_ENABLE_RUNTIMES STREQUAL "all" )
Expand Down