[PATCH] D58144: [xray][tests][RHDTS] Add -lstdc++ after LLVM libs, resolving link error with RHDTS

Hubert Tong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 12 13:29:17 PST 2019


hubert.reinterpretcast created this revision.
hubert.reinterpretcast added reviewers: sfertile, nemanjai.
Herald added subscribers: Sanitizers, jdoerfert, delcypher, mgorny, dberris.
Herald added projects: LLVM, Sanitizers.

A link error was encountered when using the Red Hat Developer Toolset. In the RHDTS, `libstdc++.so` is a linker script that may resolve symbols to a static library. This patch places `-lstdc++` later in the ordering.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D58144

Files:
  lib/xray/tests/CMakeLists.txt


Index: lib/xray/tests/CMakeLists.txt
===================================================================
--- lib/xray/tests/CMakeLists.txt
+++ lib/xray/tests/CMakeLists.txt
@@ -48,8 +48,7 @@
 
 set(XRAY_TEST_ARCH ${XRAY_SUPPORTED_ARCH})
 set(XRAY_UNITTEST_LINK_FLAGS
-  ${CMAKE_THREAD_LIBS_INIT}
-  -l${SANITIZER_CXX_ABI_LIBRARY})
+  ${CMAKE_THREAD_LIBS_INIT})
 
 if (NOT APPLE)
   # Needed by LLVMSupport.
@@ -81,6 +80,8 @@
   append_list_if(COMPILER_RT_HAS_LIBEXECINFO -lexecinfo XRAY_UNITTEST_LINK_FLAGS)
 endif()
 
+list(APPEND XRAY_UNITTEST_LINK_FLAGS -l${SANITIZER_CXX_ABI_LIBRARY})
+
 macro(add_xray_unittest testname)
   cmake_parse_arguments(TEST "" "" "SOURCES;HEADERS" ${ARGN})
   if(UNIX AND NOT APPLE)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58144.186536.patch
Type: text/x-patch
Size: 715 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190212/e93ce07b/attachment.bin>


More information about the llvm-commits mailing list