Page MenuHomePhabricator

[openmp] [test] Try to link -latomic to provide atomics when available

Authored by mgorny on Feb 17 2017, 2:03 AM.



When using -rtlib=libgcc, the fallback implementation of __atomic_*
builtins is provided via libatomic (included in GCC). However, neither
GCC itself nor clang link libatomic implicitly, and it seems that GCC
upstream expects projects to link it explicitly as necessary.

Since compiler-rt provides __atomic_* builtins directly in the main
library, check if they are provided by the default libraries first.
If they are not, check if -latomic is available to provide them
and add explicit -latomic for tests in this case.

This fixes unresolved __atomic_load() references when running openmp
tests on i386 with libgcc backend.

Diff Detail


Event Timeline

mgorny created this revision.Feb 17 2017, 2:03 AM

Le gentle ping.

This revision is now accepted and ready to land.Feb 24 2017, 1:30 PM
This revision was automatically updated to reflect the committed changes.