Fix linker script generation for in-tree builds

llvm-svn: 283700
diff --git a/libcxx/test/CMakeLists.txt b/libcxx/test/CMakeLists.txt
index d9be0df..edebaee 100644
--- a/libcxx/test/CMakeLists.txt
+++ b/libcxx/test/CMakeLists.txt
@@ -11,6 +11,18 @@
 set(LIBCXX_LIT_VARIANT "libcxx" CACHE STRING
     "Configuration variant to use for LIT.")
 
+# The tests shouldn't link to any ABI library when it has been linked into
+# libc++ statically or via a linker script.
+if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY OR LIBCXX_ENABLE_ABI_LINKER_SCRIPT)
+  set(LIBCXX_CXX_ABI_LIBNAME "none")
+endif()
+
+# The tests shouldn't link to libunwind if we have a linker script which
+# already does so.
+if (LIBCXX_ENABLE_ABI_LINKER_SCRIPT)
+  set(LIBCXXABI_USE_LLVM_UNWINDER OFF)
+endif()
+
 pythonize_bool(LIBCXX_ENABLE_EXCEPTIONS)
 pythonize_bool(LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY)
 pythonize_bool(LIBCXX_ENABLE_FILESYSTEM)
@@ -24,12 +36,6 @@
 pythonize_bool(LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB)
 pythonize_bool(LIBCXX_HAS_EXTERNAL_THREAD_API)
 
-# The tests shouldn't link to any ABI library when it has been linked into
-# libc++ statically or via a linker script.
-if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY OR LIBCXX_ENABLE_ABI_LINKER_SCRIPT)
-  set(LIBCXX_CXX_ABI_LIBNAME "none")
-endif()
-
 # By default, for non-standalone builds, libcxx and libcxxabi share a library
 # directory.
 if (NOT LIBCXX_CXX_ABI_LIBRARY_PATH)