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 only adding -ldl for non-BSD systems.