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

Andrzej Warzynski via Phabricator via flang-commits flang-commits at lists.llvm.org
Fri Jun 4 09:42:03 PDT 2021


awarzynski added a comment.

In D103540#2797278 <https://reviews.llvm.org/D103540#2797278>, @Renaud-K wrote:

> I see that flangFrontend and flangFrontendTool  libraries have been introduced and include dependencies with the Fortran libraries.

No. These libraries implement the frontend driver. They depend on the frontend libraries, because they "drive" it.

In D103540#2797278 <https://reviews.llvm.org/D103540#2797278>, @Renaud-K wrote:

> 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.

This is simply the difference between static and shared libraries, right? There is nothing special about `flangFrontend` here.

> So the attempt to have an umbrella library does not work because the linker does not link with the dependent libraries. In a shared lib flow, you have to make them explicit.

In both cases (static and shared) all dependencies should be expressed explicitly. It just so happens that in the case of static libraries, one can miss a dependency and things will build just fine anyway. That's because linking is delayed until the final binary is build (e.g. `flang-new`): as long as the missing dependency is also present in the final binary, everything is fine. So the missing dependency could be coming from yet another library.

> 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.

This did indeed come up in the past:

- https://github.com/llvm/llvm-project/commit/d007bbd986d9ab004c34efaca27aff4a7633b9e9
- https://reviews.llvm.org/D89111
- https://reviews.llvm.org/D88484

In order to defend Flang from such failures in the future, we've set-up a Buildbot worker that builds with `BUILD_SHARED_LIBS` set to `On`.

As you admitted, there is no issue with `llvm-project/flang` and this change is not required.

In D103540#2799260 <https://reviews.llvm.org/D103540#2799260>, @Renaud-K wrote:

> Fixed issue this way: https://github.com/flang-compiler/f18-llvm-project/pull/822

Great, it sounds like you've resolved your original issue!


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