[Openmp-commits] [PATCH] D95371: [OpenMP] Use C++ to link libomp.so when LLVM libraries are included
Johannes Doerfert via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Mon Jan 25 13:14:27 PST 2021
jdoerfert added a comment.
In D95371#2520747 <https://reviews.llvm.org/D95371#2520747>, @AndreyChurbanov wrote:
>>> That's right. Regardless that the code is written in C++ the intention is to not have any dependency on C++ runtime. The libomp.so should work fine with C applications as well as with Fortran codes those often cannot link C++ runtime.
>>
>> Right. With profile support we got C++ dependences. So if you disable the profile support you can remove the dependence. What if we set the linker language to CXX if the profile support is enabled? Is that a problem?
>
> But if profile support is enabled by default and will got into LLVM release, then people with pure C codes of Fortran codes will be surprised to see their OpenMP application depends on C++ runtime.
> E.g. if they provide Fortran redistributables with Fortran application, it won't work because of C++ runtime dependency.
> Or somebody may setup flang without clang, or gfortran without gcc, and link with libomp.
> Not sure it is immediate problem, but in length of time such things will happen.
This is a conceptual argument though. What is more likely/beneficial and where do we require people to compile their own libomp. Arguably, profiling alone is not the most critical feature but from a practical perspective I think C and Fortran apps without C++ available is "not necessarily the future". If there are users that want to, they can still build libomp.so w/o C++ dependence. That said, we could debate if that is worth it as we could then utilize the stdlib more broadly, which is arguably a good thing.
FWIW, even if we decide to flip profiling off after the release branch split we can still back port it as a fix. For now, I'd argue for `set(LIBOMP_LINKER_LANGUAGE CXX)` guarded by the profiler flag.
Final thought: It might even be not too hard to compile two libraries, libomp.so and libomp.C.so, such that the former can have C++ features, maybe even a C++ interface for certain things.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D95371/new/
https://reviews.llvm.org/D95371
More information about the Openmp-commits
mailing list