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

Paul Scoropan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 10 10:58:59 PDT 2023


pscoro added inline comments.


================
Comment at: flang/cmake/modules/AddFlang.cmake:68
   llvm_add_library(${name} ${LIBTYPE} ${ARG_UNPARSED_ARGUMENTS} ${srcs})
+  set_target_properties(${name} PROPERTIES POSITION_INDEPENDENT_CODE ON)
 
----------------
This is something I am still investigating.

PIC is needed for the object libraries if FlangRT is being built as shared. I am thinking I will add a condition for this to only be enabled for FortranRuntime and FortranDecimalRT. Also, if my understanding is correct, if we build FlangRT as static this change may also not be needed (and keeping it may be slightly less optimal?), so I may ad a condition for this as well. 

My understanding of PIC is limited so if anybody sees any problems with my understanding please let me know.


================
Comment at: flang/include/flang/Runtime/float128.h:42
  */
-#if __x86_64__
-#if __GNUC__ >= 7 || __clang_major__ >= 7
-#define HAS_FLOAT128 1
-#endif
-#elif defined __PPC__ && __GNUC__ >= 8
-#define HAS_FLOAT128 1
-#endif
+//#if __x86_64__
+//#if __GNUC__ >= 7 || __clang_major__ >= 7
----------------
Entirely uncertain why this code was giving me issues during my testing. I commented it out for the time being but I will take a closer look later. I hope that it is related to my setup and not something about the patch itself, however I will have to investigate further before I can draw any conclusions.


================
Comment at: flang/lib/Decimal/CMakeLists.txt:62
+if ("flang-rt" IN_LIST LLVM_ENABLE_RUNTIMES OR FLANG_RT_STANDALONE_BUILD)
+  add_flang_library(FortranDecimalRT STATIC INSTALL_WITH_TOOLCHAIN
+    binary-to-decimal.cpp
----------------
The code in AddFlang.cmake seems to build object libraries for calls to `add_flang_library` by default when STATIC argument is passed.


================
Comment at: flang/runtime/CMakeLists.txt:252
+if ("flang-rt" IN_LIST LLVM_ENABLE_RUNTIMES)
+  add_flang_library(FortranRuntime STATIC
+    ${sources}
----------------
The code in AddFlang.cmake seems to build object libraries for calls to `add_flang_library` by default when STATIC argument is passed.


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