[compiler-rt] 5665ec4 - [compiler-rt][cmake][powerpc] Remove TEST_BIG_ENDIAN from base-config-ix.cmake

David Tenty via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 1 06:45:13 PDT 2020


Author: David Tenty
Date: 2020-10-01T09:45:07-04:00
New Revision: 5665ec4e182dba9965847d3698ad64a950bb00a7

URL: https://github.com/llvm/llvm-project/commit/5665ec4e182dba9965847d3698ad64a950bb00a7
DIFF: https://github.com/llvm/llvm-project/commit/5665ec4e182dba9965847d3698ad64a950bb00a7.diff

LOG: [compiler-rt][cmake][powerpc] Remove TEST_BIG_ENDIAN from base-config-ix.cmake

It's actually not safe to call TEST_BIG_ENDIAN here, since we may be
running from the builtins build (i.e builtins-config-ix) context where
TEST_COMPILE_ONLY  is set since without builtins already built we may
fail to link, and TEST_BIG_ENDIAN internally performs tests which may
fail to link without builtins.

Fortunately powerpc is the only target that uses this information here and
we actually already know the whether we are targeting the LE variant due
to earlier macro checks, so we can simply this to remove our reliance on
TEST_BIG_ENDIAN.

Reviewed By: hubert.reinterpretcast, Whitney

Differential Revision: https://reviews.llvm.org/D88608

Added: 
    

Modified: 
    compiler-rt/cmake/base-config-ix.cmake

Removed: 
    


################################################################################
diff  --git a/compiler-rt/cmake/base-config-ix.cmake b/compiler-rt/cmake/base-config-ix.cmake
index e7f951064bf9..a4c29d2943ca 100644
--- a/compiler-rt/cmake/base-config-ix.cmake
+++ b/compiler-rt/cmake/base-config-ix.cmake
@@ -5,7 +5,6 @@
 
 include(CheckIncludeFile)
 include(CheckCXXSourceCompiles)
-include(TestBigEndian)
 
 check_include_file(unwind.h HAVE_UNWIND_H)
 
@@ -188,22 +187,13 @@ macro(test_targets)
           test_target_arch(x86_64 "" "")
         endif()
       endif()
+    elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "powerpc64le")
+      test_target_arch(powerpc64le "" "-m64")
     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.
-      cmake_push_check_state()
-      string(REPLACE "-nodefaultlibs" "" CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
-      TEST_BIG_ENDIAN(HOST_IS_BIG_ENDIAN)
-      cmake_pop_check_state()
-
-      if(HOST_IS_BIG_ENDIAN)
-        if(CMAKE_SYSTEM_NAME MATCHES "AIX")
-          test_target_arch(powerpc "" "-m32")
-        endif()
-          test_target_arch(powerpc64 "" "-m64")
-      else()
-        test_target_arch(powerpc64le "" "-m64")
+      if(CMAKE_SYSTEM_NAME MATCHES "AIX")
+        test_target_arch(powerpc "" "-m32")
       endif()
+      test_target_arch(powerpc64 "" "-m64")
     elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "s390x")
       test_target_arch(s390x "" "")
     elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "sparc")


        


More information about the llvm-commits mailing list