[flang-commits] [PATCH] D103540: [flang] Enabling flang to build with BUILD_SHARED_LIBS=On

Renaud Kauffmann via Phabricator via flang-commits flang-commits at lists.llvm.org
Thu Jun 3 13:12:23 PDT 2021


Renaud-K added a comment.

I have been looking some more into how the flang-new driver is being built. 
I see that flangFrontend and flangFrontendTool  libraries have been introduced and include dependencies with the Fortran libraries. It makes things look elegant. When we link, we just have to say flangFrontend and we get all the Fortran libraries. However when building with shared libs , you can see that the flangFrontEnd libraries are very small, they no longer include any of the code they depend on. So the attempt to have an umbrella library does not work because the linker does link with the dependent libraries. In a shared lib flow, you have to make them explicit.

If we had some very tight "C like" interfaces, you could guarantee that the driver only makes calls into the objects of the flangFrontend libraries and this could work. But with all the rich header files included which have inlined templated code you have no control over what gets called and it is only a matter of time until this breaks.  Here is the change, precisely single header file change, from the fir-dev branch that is causing the link to fail. It is a very small, very reasonable change. https://github.com/flang-compiler/f18-llvm-project/blame/fir-dev/flang/include/flang/Evaluate/expression.h#L97

I guess we could make it so the call is not inlined. But my feeling is that the umbrella library approach is brittle and that this issue will come up again.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103540



More information about the flang-commits mailing list