[PATCH] D15082: Fix the linking of unit tests in lib/asan

Sumanth Gundapaneni via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 30 09:12:59 PST 2015


sgundapa created this revision.
sgundapa added reviewers: rengolin, samsonov.
sgundapa added a subscriber: llvm-commits.

With COMPILER_RT_INCLUDE_TESTS turned ON and in a cross compiling
environment, the unit tests fail to link. This patch updates the build to use
the target linker through COMPILER_RT_TEST_COMPILER_CFLAGS

http://reviews.llvm.org/D15082

Files:
  lib/asan/tests/CMakeLists.txt

Index: lib/asan/tests/CMakeLists.txt
===================================================================
--- lib/asan/tests/CMakeLists.txt
+++ lib/asan/tests/CMakeLists.txt
@@ -34,6 +34,10 @@
   -Wno-non-virtual-dtor)
 append_list_if(COMPILER_RT_HAS_WVARIADIC_MACROS_FLAG -Wno-variadic-macros ASAN_UNITTEST_COMMON_CFLAGS)
 
+# This will ensure the target linker is used for linking unit tests
+set(ASAN_UNITTEST_COMMON_LINKFLAGS
+  ${COMPILER_RT_TEST_COMPILER_CFLAGS})
+
 # -gline-tables-only must be enough for ASan, so use it if possible.
 if(COMPILER_RT_TEST_COMPILER_ID MATCHES "Clang")
   list(APPEND ASAN_UNITTEST_COMMON_CFLAGS -gline-tables-only)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15082.41406.patch
Type: text/x-patch
Size: 654 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151130/5cc43fa8/attachment.bin>


More information about the llvm-commits mailing list