This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] Use weak attribute in interface only for static library
ClosedPublic

Authored by protze.joachim on Jul 29 2020, 9:57 AM.

Details

Summary

This is to address the issue reported at:
https://bugs.llvm.org/show_bug.cgi?id=46863

From my understanding, the issue is that these omp_ symbols want to be both external and weak. Since weak is meaningless for a shared library interface function, this patch disables the attribute, when the OpenMP library is built as shared library.

The situation of ompt_start_tool is different. This is not an interface function, but a function implemented by an OMPT tool. This function needs to be weak if possible to allow overwriting ompt_start_tool with a function implementation built into the application.

Diff Detail

Event Timeline

protze.joachim created this revision.Jul 29 2020, 9:57 AM
protze.joachim requested review of this revision.Jul 29 2020, 9:57 AM

Updated to be a bit more specific, where the external version is used.

FWIW, without verifying whether this works in detail, this sounds like a sensible solution, so +1 from me.

hans accepted this revision.Jul 31 2020, 3:16 AM

Thanks! This fixes the link error I was hitting.

This revision is now accepted and ready to land.Jul 31 2020, 3:16 AM