$OpenBSD: patch-runtime_flang_CMakeLists_txt,v 1.8 2019/09/20 14:51:52 bcallah Exp $

Replace -lrt with -laio_compat
Appease lld
Work around standalone preprocessing of F95 files with C compiler

Index: runtime/flang/CMakeLists.txt
--- runtime/flang/CMakeLists.txt.orig
+++ runtime/flang/CMakeLists.txt
@@ -18,7 +18,7 @@ enable_language(C ASM Fortran) # Enable assembly and F
 
 SET(ASM_OPTIONS "-DLINUX_ELF")
 SET(CMAKE_ASM_FLAGS "${CFLAGS} ${ASM_OPTIONS}" )
-SET(CMAKE_SHARED_LINKER_FLAGS "-no-flang-libs")
+SET(CMAKE_SHARED_LINKER_FLAGS "-no-flang-libs -L/usr/lib")
 
 # We are using Fortran driver to build this library with fresh compiler
 # components, so point its binary directory to the build directory to pick up
@@ -508,7 +508,7 @@ add_dependencies(flang_shared flang_static)
 
 target_link_libraries(flang_shared ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib/libflangrti.so)
 # Resolve symbols against libm and librt
-target_link_libraries(flang_shared m rt)
+target_link_libraries(flang_shared m aio_compat)
 
 set(SHARED_LIBRARY FALSE)
 
