This is an archive of the discontinued LLVM Phabricator instance.

[flang] Avoid dependency of runtime library on pthread for MinGW
ClosedPublic

Authored by mmuetzel on Apr 24 2023, 3:59 AM.

Details

Summary

When building the Fortran runtime on MinGW, clock_gettime is currently used. That function is provided by the pthread library on that platform. That means that all programs that link libFortranRuntime also require to be linked with pthread on that platform.

There is already a code path (for MSVC) that doesn't use clock_gettime in the implementation of the Fortran library.
Use the same code path also on MinGW by undefining CLOCKID.

Diff Detail

Event Timeline

mmuetzel created this revision.Apr 24 2023, 3:59 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 24 2023, 3:59 AM
mmuetzel requested review of this revision.Apr 24 2023, 3:59 AM
vzakhari accepted this revision.Apr 24 2023, 8:53 AM

Thank you! LGTM

This revision is now accepted and ready to land.Apr 24 2023, 8:53 AM
mmuetzel updated this revision to Diff 516636.Apr 24 2023, 11:46 PM

Thank you for the review.
I updated the diff to fix the grammar in the comment. (Sorry for not noticing before.)

I don't have push privileges for the repository. Could you please push that diff for me?

Hi @mmuetzel, I will merge this today, but please obtain the commit access - it is easy ;)

This revision was landed with ongoing or failed builds.Apr 25 2023, 10:17 AM
This revision was automatically updated to reflect the committed changes.