HomePhabricator

Ensure correct pthread flags and libraries are used

Authored by dim on Apr 3 2019, 11:11 AM.

Description

Ensure correct pthread flags and libraries are used

On most platforms, certain compiler and linker flags have to be passed
when using pthreads, otherwise linking against libomp.so might fail with
undefined references to several pthread functions.

Use CMake's find_package(Threads) to determine these for standalone
builds, or take them (and optionally modify them) from the top-level
LLVM cmake files.

Also, On FreeBSD, ensure that libomp.so is linked against libm.so,
similar to NetBSD.

Adjust test cases with hardcoded -lpthread flag to use the common
build flags, which should now have the required pthread flags.

Reviewers: emaste, jlpeyton, krytarowski, mgorny, protze.joachim, Hahnfeld

Reviewed By: Hahnfeld

Subscribers: AndreyChurbanov, tra, EricWF, Hahnfeld, jfb, jdoerfert, openmp-commits

Tags: #openmp

Differential Revision: https://reviews.llvm.org/D59451

llvm-svn: 357618

Details

Committed
dimApr 3 2019, 11:11 AM
Reviewer
Hahnfeld
Differential Revision
D59451: Fix gettid warnings and one test on FreeBSD
Parents
rG9c3978188939: [OPENMP]Add codegen for firstprivate vars with allocate clause.
Branches
Unknown
Tags
Unknown