Revert "[compiler-rt] Cleanup usage of C++ ABI library"

This reverts r354132 because it breaks sanitizer-x86_64-linux:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/19915

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk/lib/fuzzer@354153 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 052c0f1..485153b 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -17,11 +17,10 @@
 set(LIBFUZZER_UNITTEST_LINK_FLAGS ${COMPILER_RT_UNITTEST_LINK_FLAGS})
 list(APPEND LIBFUZZER_UNITTEST_LINK_FLAGS --driver-mode=g++)
 
-foreach(lib ${SANITIZER_TEST_CXX_LIBRARIES})
-  list(APPEND LIBFUZZER_UNITTEST_LINK_FLAGS -l${lib})
-endforeach()
-if(NOT WIN32)
-  list(APPEND LIBFUZZER_UNITTEST_LINK_FLAGS ${CMAKE_THREAD_LIBS_INIT})
+if(APPLE OR CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
+  list(APPEND LIBFUZZER_UNITTEST_LINK_FLAGS -lc++ -lpthread)
+elseif(NOT WIN32)
+  list(APPEND LIBFUZZER_UNITTEST_LINK_FLAGS -lstdc++ -lpthread)
 endif()
 
 if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" AND COMPILER_RT_LIBCXX_PATH)