[PATCH] D75772: [compiler-rt] Set builtins and cxx library for target arch test

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 6 14:55:20 PST 2020


phosek created this revision.
phosek added reviewers: smeenai, beanz.
Herald added subscribers: llvm-commits, Sanitizers, mgorny, dberris.
Herald added projects: Sanitizers, LLVM.

When testing whether target arch is supported, take the selected
builtins and cxx library into consideration otherwise the test may
fail even when it shouldn't.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D75772

Files:
  compiler-rt/cmake/Modules/CompilerRTUtils.cmake


Index: compiler-rt/cmake/Modules/CompilerRTUtils.cmake
===================================================================
--- compiler-rt/cmake/Modules/CompilerRTUtils.cmake
+++ compiler-rt/cmake/Modules/CompilerRTUtils.cmake
@@ -136,6 +136,13 @@
       endif()
       set(SAVED_CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS})
       set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${argstring}")
+      if(SANITIZER_CXX_ABI_LIBNAME STREQUAL "libc++" AND SANITIZER_CXX_ABI_INTREE)
+        set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -nostdlib++")
+      endif()
+      if(COMPILER_RT_USE_BUILTINS_LIBRARY)
+        set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${COMPILER_RT_BUILTINS_LIBRARY}")
+      endif()
+      set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${argstring}")
       try_compile(CAN_TARGET_${arch} ${CMAKE_BINARY_DIR} ${SIMPLE_SOURCE}
                   COMPILE_DEFINITIONS "${TARGET_${arch}_CFLAGS} ${FLAG_NO_EXCEPTIONS}"
                   OUTPUT_VARIABLE TARGET_${arch}_OUTPUT)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75772.248832.patch
Type: text/x-patch
Size: 1035 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200306/19fec8fd/attachment.bin>


More information about the llvm-commits mailing list