Skip to content

Commit 6ca63cf

Browse files
committed
Merge branch 'users/meinersbur/flang_runtime' into users/meinersbur/flang_runtime_shared
2 parents 68d021f + 19fe1a3 commit 6ca63cf

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
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,

0 commit comments

Comments
 (0)