Merging r324848:
------------------------------------------------------------------------
r324848 | dim | 2018-02-11 21:16:20 +0100 (Sun, 11 Feb 2018) | 30 lines

Use CMAKE_DL_LIBS and CMAKE_THREAD_LIBS_INIT for Bitcode tests

Summary:
While testing for the 6.0.0 release candidates, I had many link
failures during the build of the test-suite, similar to:

```
[ 78%] Linking CXX executable simd_ops_test_op_pmulld_275
Scanning dependencies of target simd_ops_test_op_vpmulld_390
/usr/local/bin/ld: cannot find -ldl
```

This is because some of the Bitcode tests unconditionally add `-ldl` to
`LDFLAGS`.  On FreeBSD, NetBSD and OpenBSD there is no libdl, as the
required functionality is already built into libc.

Fix it by using CMake's `CMAKE_DL_LIBS` instead, which provides the
correct link library names.

While here, also use `CMAKE_THREAD_LIBS_INIT` instead of hardcoding
`-lpthread`.

Reviewers: asbirlea, echristo, emaste, krytarowski, MatzeB, tra

Reviewed By: krytarowski

Subscribers: mgorny, llvm-commits

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

------------------------------------------------------------------------

llvm-svn: 324873
4 files changed