[PATCH] D154869: [Flang] [FlangRT] Implement FlangRT library as solution to Flang's runtime LLVM integration

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 18 12:24:09 PDT 2023


efriedma added inline comments.


================
Comment at: flang/runtime/CMakeLists.txt:251
 
-  INSTALL_WITH_TOOLCHAIN
-)
+if (DEFINED LLVM_ENABLE_RUNTIMES AND "flang-rt" IN_LIST LLVM_ENABLE_RUNTIMES)
+  add_flang_library(FortranRuntime STATIC
----------------
pscoro wrote:
> efriedma wrote:
> > This "if" doesn't make sense to me.  If we're not building flang-rt, we shouldn't be here, so I don't see why you need an "if" in the first place.
> `add_subdirectory(runtime)` is a line that still exists in `flang/CMakeLists.txt`. This exists because `Fortran_main` is still being built at the same time as the compiler, and to do so, the runtime subdirectory still needs to be added to flang (`flang/CMakeLists.txt` -> `add_subdirectory(runtime)` -> `flang/runtime/CMakeLists.txt` -> `add_subdirectory(FortranMain)`. The solution I had was to just add a check around the `FortranRuntime` library production so that it only happens for flang-rt.
> 
> If you have a better solution let me know. Overall, I'm not sure if Fortran_main is currently being handled in the best way (ie, its still being built at the same time as the compiler, which doesn't seem ideal), but am not sure what course of action to take with it since it doesn't really belong in flang-rt either (see documentation for details)
Fortran_main should be "part of" flang-rt in the sense that building flang-rt builds it.  Most of the same reasons we want to build flang-rt.a as a runtime apply.

Since the output needs to be separate, building flang-rt should produce two libraries: flang-rt.a and FortranMain.a.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D154869/new/

https://reviews.llvm.org/D154869



More information about the cfe-commits mailing list