[PATCH] D38277: [compiler-rt}[CMake] Fix configuration on PowerPC with sanitizers

Jonas Hahnfeld via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 26 15:31:01 PDT 2017


Hahnfeld created this revision.
Herald added subscribers: mgorny, dberris, nemanjai.

TEST_BIG_ENDIAN() performs compile tests that will fail with
-nodefaultlibs when building under LLVM_USE_SANITIZER.


https://reviews.llvm.org/D38277

Files:
  cmake/base-config-ix.cmake


Index: cmake/base-config-ix.cmake
===================================================================
--- cmake/base-config-ix.cmake
+++ cmake/base-config-ix.cmake
@@ -148,7 +148,14 @@
         endif()
       endif()
     elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "powerpc")
+      # Strip out -nodefaultlibs when calling TEST_BIG_ENDIAN. Configuration
+      # will fail with this option when building with a sanitizer.
+      set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
+      string(REPLACE "-nodefaultlibs" "" CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
       TEST_BIG_ENDIAN(HOST_IS_BIG_ENDIAN)
+      # Undo the change.
+      set(CMAKE_REQUIRED_FLAGS "${OLD_CMAKE_REQUIRED_FLAGS}")
+
       if(HOST_IS_BIG_ENDIAN)
         test_target_arch(powerpc64 "" "-m64")
       else()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38277.116660.patch
Type: text/x-patch
Size: 809 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170926/ff239a3a/attachment-0001.bin>


More information about the cfe-commits mailing list