This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] Only enable version script if supported
ClosedPublic

Authored by tianshilei1992 on Apr 30 2023, 1:28 PM.

Details

Summary

The linker flag --version-script may not be supported by all linkers, such as
macOS's linker. libomp is already capable of detecting whether the linker supports
it and append the linker flag accordingly. Since currently we assume libomptarget
only works on Linux, we don't do the check accordingly. This patch simply adds
the check before adding it to linker flag. This will be the first patch to make
OpenMP target offloading work on macOS. Note that CMake files in plugins are
not touched before they are going to be removed pretty soon anyway.

Diff Detail

Event Timeline

tianshilei1992 created this revision.Apr 30 2023, 1:28 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 30 2023, 1:28 PM
tianshilei1992 requested review of this revision.Apr 30 2023, 1:28 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 30 2023, 1:28 PM
tianshilei1992 added inline comments.Apr 30 2023, 1:34 PM
openmp/libomptarget/src/CMakeLists.txt
34

Actually we can remove it now

jhuber6 accepted this revision.Apr 30 2023, 2:30 PM

This should be fine for targets that don't support it, thanks.

This revision is now accepted and ready to land.Apr 30 2023, 2:30 PM
This revision was automatically updated to reflect the committed changes.